Last active
November 10, 2017 06:55
-
-
Save goofmint/baf45b16439d6f7e75c12482ef982d3e to your computer and use it in GitHub Desktop.
This file contains 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
$(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