Created
March 25, 2014 00:29
-
-
Save alexmangini/9752459 to your computer and use it in GitHub Desktop.
A basic content switcher script. Can be used for multiple tabbed content on a page.
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
jQuery('.js-tab-link a').click(function(){ | |
var that = jQuery(this); | |
var tabIndex = that.parent().index(); | |
var tabs = that.parents('.gallery-item').find('.gallery-cover-content'); | |
that.parent('.js-tab-link').siblings().removeClass('gallery-active'); | |
that.parent('.js-tab-link').addClass('gallery-active'); | |
tabs.removeClass('gallery-active'); | |
tabs.eq(tabIndex).addClass('gallery-active'); | |
event.preventDefault(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment