2009-11-29 59 views
0

使用jQuery插件http://jquery.com/plugins/project/jquerylightbox_baljQuery的燈箱插件通過balupton

有沒有辦法有標題和一個/上一個按鈕始終出現。目前,我們必須懸停以顯示這些內容,而我的用戶大多不會注意到這一點。

LightBox2和其他人允許這個,但我需要它基於jQuery,因爲其他框架會干擾我的其他js。

這是這個網站:http://BiblePro.BibleOcean.com

+1

哇,這是最瘋狂的阿賈克斯聖經 – stimms 2009-11-29 16:42:30

回答

1

這是目前不可能作爲一個選項,但是可以修改燈箱js文件有以下變化:

 // Prev 
     $('#lightbox-nav-btnPrev').unbind().hover(function() { // over 
      $(this).css({ 'background' : 'url(' + $.Lightbox.files.images.prev + ') left 45% no-repeat' }); 
     },function() { // out 
      $(this).css({ 'background' : 'transparent url(' + $.Lightbox.files.images.blank + ') no-repeat' }); 
     }).click(function() { 
      $.Lightbox.showImage($.Lightbox.images.prev()); 
      return false; 
     }); 

到:

 // Prev 
     $('#lightbox-nav-btnPrev').css({ 'background' : 'url(' + $.Lightbox.files.images.prev + ') left 45% no-repeat' }); 

和相同接下來的幾行。

後來你會發現:

   // If not first, show previous button 
       if (!this.images.first(image)) { 
        // Not first, show button 
        $('#lightbox-nav-btnPrev').show(); 
       } 

       // If not last, show next button 
       if (!this.images.last(image)) { 
        // Not first, show button 
        $('#lightbox-nav-btnNext').show(); 
       } 

修改成:

   // If not first, show previous button 
       if (!this.images.first(image) && !this.images.last(image)) { 
        // Not first, show button 
        $('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').show(); 
       } 

,並應爲你做它。你可以在你的html中包含未定義的js文件,或者將js文件縮小並保存(我使用YUI js壓縮器)。

我會考慮讓它成爲未來版本的一個選項。

+0

謝謝老兄!我會嘗試的 – 2009-12-01 02:41:57

2

考慮使用此方法。如果你沒有得到這給使用內置的jQuery的東西來解決你的問題的做法任何答案。

我已經成功地編輯了jQuery插件的樣式,以實現我想要的樣式,如果它尚未提供它的話。 (除非通過jQuery功能實現,而不僅僅是使用樣式)。

使用Firebug或IE工具欄查看懸停時呈現給這些元素的樣式,然後更改該樣式以反映您想要的基本樣式本身而不是onhover。

感謝