2011-11-22 5 views
0

다음 코드를 사용하여 jquery에서 탭을 만들고 누군가가 클릭하면 해당 탭이 열립니다. 따라서 지정된 간격으로 탭을 회전시킬 수 있도록 탭을 수정할 수 있습니다. 기존를 수정하려는 것처럼jquery tab 자동 슬라이드

// Tabs 
    // When page loads... 
    $(".tab-content").hide(); //Hide all content 
    $("ul.sidebar-tabs li:first").addClass("active").show(); //Activate first tab 
    $(".tab-content:first").show(); //Show first tab content 

    // On Click Event 
    $("ul.sidebar-tabs li").click(function() { 

     $("ul.sidebar-tabs li").removeClass("active"); //Remove any "active" class 
     $(this).addClass("active"); //Add "active" class to selected tab 
     $(".tab-content").hide(); //Hide all tab content 

     var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content 
     $(activeTab).fadeIn(); //Fade in the active ID content 
     return false; 
    }); 

같은 HTML 코드는,

<ul class="sidebar-tabs"> 
    <li><a href="#tab-1">Tab1</a></li> 
    <li><a href="#tab-2">Tab2</a></li> 
</ul><!-- //sidebar-tabs --> 
<div class="tab-container"> 
    <div id="tab-1" class="tab-content"> 
    <div> 
    <div id="tab-2" class="tab-content"> 
    <div> 
</div> 

답변

0

당신이 http://www.smartnetzone.com/blog_demos/auto_rotating_tabs/

시작할 수 있습니다이 http://flowplayer.org/tools/tabs/index.html

그리고 또 다른 예를보십시오 당신은 이런 식으로 할 수 있습니다 :

+0

위의 코드를 수정할 수 있습니까? – Ajay

+0

내 답변을 업데이트하고 작동하는지 확인하고 회신 해주십시오! – coder

+0

번호. 작동하지 않습니다. 또한 html 코드를 추가했습니다 ... – Ajay