Skip to content

Instantly share code, notes, and snippets.

@reinh
Created November 17, 2010 21:29
Show Gist options
  • Select an option

  • Save reinh/704125 to your computer and use it in GitHub Desktop.

Select an option

Save reinh/704125 to your computer and use it in GitHub Desktop.
$.fn.subnavTabs = function(options) {
var opts = $.extend({}, $.fn.subnavTabs.defaults, options);
return this.each(function() {
var self = $(this),
tabs = $(self.attr('rel')),
items = self.children('li'),
links = items.children('a')
show_active = function() {
tabs.children('div.box').hide();
$(items.filter('.active').children('a').attr('href')).show();
},
set_active = function(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