Created
November 17, 2010 21:28
-
-
Save reinh/704122 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.fn.subnavTabs = function(options) { | |
| var opts = $.extend({}, $.fn.subnavTabs.defaults, options); | |
| return this.each(function() { | |
| var self = $(this), | |
| items = self.children('li'), | |
| links = items.children('a') | |
| tabs = $(self.attr('rel')), | |
| show_active = function() { | |
| tabs.children('div.box').hide(); | |
| $(items.filter('.active').children('a').attr('href')).show(); | |
| }, | |
| set_active = function(obj) { | |
| console.log(obj); | |
| items.removeClass('active'); | |
| obj.parent('li').addClass('active'); | |
| }; | |
| show_active(); | |
| links.click(function() { | |
| set_active($(this)); | |
| show_active(); | |
| return false; | |
| }); | |
| }); | |
| }; | |
| $.fn.subnavTabs.defaults = {}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment