/ Published in: jQuery
The following jquery presumes HTML involving: (contains divs of each tab) (contains divs of each content)
Expand |
Embed | Plain Text
$(document).ready(function() { // hide all tabbed content other than the first or active div $("#tabbed_content > div").not(".active").hide(); // when user clicks a tab, display the corresponding content $("#tabs > div").click(function() { var tab_selected = $(this).index() $("#tabs > div").removeClass("active") $(this).addClass("active") $("#tabbed_content > div") .hide() .removeClass("active") $("#tabbed_content > div:eq("+tab_selected+")") .show() .addClass("active") }) })
You need to login to post a comment.
