Skip to content

Instantly share code, notes, and snippets.

@goofmint
Last active November 10, 2017 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goofmint/baf45b16439d6f7e75c12482ef982d3e to your computer and use it in GitHub Desktop.
Save goofmint/baf45b16439d6f7e75c12482ef982d3e to your computer and use it in GitHub Desktop.
$(function() {
var tabbableController = {
__name: 'TabbableController',
__ready: function() {
},
'.nav-tabs a click': function(context) {
context.event.preventDefault();
var cur = $(context.event.currentTarget);
var tabName = cur.attr('data-tab-name');
var target = this.$find('[data-tab-name="' + tabName + '"]');
this.$find('.nav-tabs > *').removeClass('active');
cur.closest('.nav-tabs > *').addClass('active');
this.$find('.tab-pane').removeClass('active');
this.$find('.tab-pane').filter(target).addClass('active');
}
};
$('.tabbable').each(function() {
h5.core.controller(this, tabbableController);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment