2011-10-04 53 views
4

我使用Tab Slide Out Jquery插件。 http://wpaoli.building58.com/2009/09/jquery-tab-slide-out-plugin/使用jQuery滑出標籤 - 需要多個

我有一個標籤出現在左邊,但我想要另一個獨立的標籤在右邊。 當我複製css,js和div的塊時,右邊的標籤出現,但是我只能激活左邊的那個,如果我激活右邊的那個。

此外,聯繫人圖片只出現在右側,所以我只能激活正確的選項卡。 我如何編碼這個,以便我可以在一個頁面上有多個選項卡並獨立激活它們?

$(function(){ 
     $('.slide-out-div').tabSlideOut({ 
      tabHandle: '.handle',        //class of the element that will be your tab 
      pathToTabImage: 'images/contact_tab.gif',   //path to the image for the tab (optionaly can be set using css) 
      imageHeight: '122px',        //height of tab image 
      imageWidth: '40px',        //width of tab image  
      tabLocation: 'left',        //side of screen where tab lives, top, right, bottom, or left 
      speed: 300,          //speed of animation 
      action: 'click',         //options: 'click' or 'hover', action to trigger animation 
      topPos: '200px',         //position from the top 
      fixedPosition: false        //options: true makes it stick(fixed position) on scroll 
     }); 

     $('.slide-out-div-apps').tabSlideOut({ 
      tabHandle: '.handle',        //class of the element that will be your tab 
      pathToTabImage: 'images/contact_tab.gif',   //path to the image for the tab (optionaly can be set using css) 
      imageHeight: '122px',        //height of tab image 
      imageWidth: '40px',        //width of tab image  
      tabLocation: 'right',        //side of screen where tab lives, top, right, bottom, or left 
      speed: 300,          //speed of animation 
      action: 'click',         //options: 'click' or 'hover', action to trigger animation 
      topPos: '200px',         //position from the top 
      fixedPosition: false        //options: true makes it stick(fixed position) on scroll 
     }); 


    }); 

這裏是我的CSS

.slide-out-div { 
    padding: 20px; 
    width: 250px; 
    background: #f2f2f2; 
    border: #29216d 2px solid; 
} 

.slide-out-div-apps { 
    padding: 20px; 
    width: 250px; 
    background: #f2f2f2; 
    border: #29216d 2px solid; 
} 
+0

嗨,你有沒有得到這個工作?我也有同樣的問題。請讓我知道你是如何解決它的。謝謝 –

+0

嗨 - 是的,我得到了這個工作。你想讓我在這裏發佈解決方案嗎? –

回答

3

你的問題是tabHandle:」 .handle

爲了解決這個添加其他類各.handle所以例如你可以有.handle.first和.handle.second

這樣每個觸發器都是唯一的。乾杯

+0

噢好的。我看到你也解決了它。我也以同樣的方式解決了這個問題。做得好。我接受了你的回答。 ;-) –

+0

嗨Khuram,與您的解決方案,它仍然工作在IE7和8? Mine在這些瀏覽器中根本不顯示。謝謝 –

+0

嗨 - 我恐怕我在IE9(或10我認爲),但它似乎在IE中工作。這裏是我的版本,請隨時複製javascript http://dl.dropbox.com/u/3417415/tabSlideOut/tabSlideOut.html –