2011-03-27 60 views
0

我設法讓Vertical jScrollPane with tabs工作。我怎樣才能使它淡入淡出?我嘗試添加延遲和淡入/淡出到show()hide(),但它要麼不工作,要麼顯示標籤應該存在的位置。jScrollPane標籤 - 如何讓它們淡入淡出?

這是我試過修改的代碼。一切都與jscrollpane網站上的代碼相同。

 <script type="text/javascript" id="sourcecode"> 
     $(function() 
     { 
      // Create the "tabs" 
      $('.tabs').each(
       function() 
       { 
        var currentTab, ul = $(this); 
        $(this).find('a').each(
         function(i) 
         { 
          var a = $(this).bind(
           'click', 
           function() 
           { 
            if (currentTab) { 
             ul.find('a.active').removeClass('active'); 
             $(currentTab).hide(); 
            } 
            currentTab = $(this).addClass('active') 
                .attr('href'); 
            $(currentTab).show().jScrollPane(); 
            return false; 
           } 
          ); 
          $(a.attr('href')).hide(); 
         } 
        ); 
       } 
      ); 
     }); 
    </script> 

任何形式的幫助表示讚賞。

回答

1

也許這樣嗎?你想淡化什麼?滾動窗格或標籤框?

var a = $(this).bind('click',function(){ 
if (currentTab) { 
    ul.find('a.active').removeClass('active'); 
    $(currentTab).fadeOut("slow"); 
} 
currentTab = $(this).addClass('active').attr('href'); 
$(currentTab).fadeIn("slow").jScrollPane(); 
return false; 
}); 

如果你想動畫滾動... :)

var a = $(this).bind('click',function(){ 
if (currentTab) { 
    ul.find('a.active').removeClass('active'); 
    $(currentTab).fadeOut("slow"); 
} 
currentTab = $(this).addClass('active').attr('href'); 
$(currentTab).fadeIn("slow").jScrollPane(); 
$(".jspVerticalBar").css("opacity", "0"); 
$(".jspVerticalBar").animate({opacity: 1}, 400); 
return false; 
}); 
+0

謝謝!我希望窗格在從一個窗口切換到另一個時消失。 – Cris 2011-03-27 14:03:11

+0

我剛剛嘗試過,它效果很好!我已將$(currentTab).fadeOut(「slow」);'改爲原來的'$(currentTab).hide();',因爲當切換窗格時,前一個窗格在淡出時暫時出現。再次感謝! – Cris 2011-03-27 14:09:10

+0

感謝滾動條的動畫! :d – Cris 2011-03-29 09:48:11