i have 3 tabs and i want to make active (when page loads) second tab. And i wonder if is possible to make tabs rotate (i read about this command .tabs( "rotate" , ms , [continuing] ) but i dont know where to put it)
i use this code for my ajax tabs
Code:
$(document).ready(function() {
//When page loads...
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() {
$("ul.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;
});
});
and this for html
Code:
<ul class="tabs">
<li><a href="#tab1">Pages</a></li>
<li><a href="#tab2">Categories</a></li>
<li><a href="#tab3">Follow us</a></li>
</ul>
<div class="tab_container">
<div id="tab1" class="tab_content">
x<!--Content-->
</div>
<div id="tab2" class="tab_content">
y<!--Content-->
</div>
<div id="tab3" class="tab_content">
z<!--Content-->
</div>
</div>
__________________
Please login or register to view this content. Registration is FREE - open blog | working on it ...
|