Posted By

jelontok on 01/04/11


jquery tabs

Versions (?)

jQuery - Easy Tabs

 / Published in: jQuery

easy tabs

  1. //Default Action
  2. $(".tab-content").hide(); //Hide all content
  3. $("ul.tabs li:first").addClass("active").show(); //Activate first tab
  4. $(".tab-content:first").show(); //Show first tab content
  6. //On Click Event
  7. $("ul.tabs li").click(function() {
  8. $("ul.tabs li").removeClass("active"); //Remove any "active" class
  9. $(this).addClass("active"); //Add "active" class to selected tab
  10. $(".tab-content").hide(); //Hide all tab content
  11. var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
  12. $(activeTab).fadeIn(); //Fade in the active content
  13. return false;
  14. });

Report this snippet  

You need to login to post a comment.