Skip to content

Instantly share code, notes, and snippets.

@alexmangini
Created March 25, 2014 00:29
Show Gist options
  • Save alexmangini/9752459 to your computer and use it in GitHub Desktop.
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.
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