/ Published in: jQuery
What it does: Takes a navigation, and swaps out corresponding content dynamically. It will automatically assign an .active class to the active list item, and unhide the first hidden div.
How it works: Add '.swap' to the navigation ul. Add a '.hidden' class to each one of the corresponding divs
Expand |
Embed | Plain Text
$('ul.swap li:first-child').addClass('active'); $('div.hidden:eq(0)').show(); $('ul.swap a').click(function(){ var $this = $(this); $('ul.swap li').removeClass('active'); $('div.hidden').hide(); $($this.attr('href')).fadeIn(); $this.parent().addClass('active'); return false; });
You need to login to post a comment.
