2011-01-26 27 views
3

我使用環球免稅店進行幻燈片放映。我想在stage旁邊放置一個較小的「較大」鏈接。如何使用jQuery和Galleria更新HTML元素?

我有這樣的代碼爲「大」按鈕:

this.fullres = this.create('div', 'fullres'); 
this.get('fullres').innerHTML = '<a href="#">Larger</a>'; 
this.appendChild('fullres', this.fullres); 

我有這樣的代碼是從頁的自定義字段中每個<img>rel=標籤的全尺寸圖像的URL分配:

<img ... rel="<?=$attachments[$i]['fullres']?>" /> 

有了JQuery,我希望能夠拉動active圖片的rel=標籤值並追加.fullres href標籤。這是我到目前爲止的代碼,但它不工作:

var title = $(.images).attr('rel'); // pulls the fullres url from the rel tag 
$('.galleria-fullres').attr('href',); //append the galleria fullres href with the rel info 
+0

過得好活動圖像的參考?它有類活躍嗎? – Aly 2011-01-26 22:42:38

回答

0

環球免稅店實際上並不像那樣。但你可以做的是創建一個按鈕進入全屏,並在全屏中顯示更大的圖像。

事情是這樣的:

$('#galleria').galleria({ 
    // other galleria options here 
    dataConfig: function(img) { 
     // get the fullscreen image 
     return { 
      big: $(img).attr('rel') 
     }; 
    } 
}); 

var galleria = Galleria.get(0); 

$('#fullscreen-button').click(function() { 
    galleria.enterFullscreen(); 
}); 
0

我不得不說,我看不出如何做到這一點的工作,因爲它是...

你知道你有一個錯字:$(.images)?應該是$('.images')

你有沒有故意忽略第二個參數$('.galleria-fullres').attr('href',);?這不應該是$('.galleria-fullres').attr('href', title);

jquery如何通過類引用元素來工作?你正在獲得一系列元素,而不僅僅是一個元素。我想這只是你的代碼的摘錄?我錯過了什麼嗎?

你可能會發布這些元素的樣本的html在瀏覽器中看到?這應該是一件非常容易的事情,但我真的無法用這些線條看到整個畫面。

相關問題