Skip to content

Instantly share code, notes, and snippets.

@SilencerWeb
Created July 6, 2017 13:09
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 SilencerWeb/0a5226129dd7f809cf993c98e90ac7c3 to your computer and use it in GitHub Desktop.
Save SilencerWeb/0a5226129dd7f809cf993c98e90ac7c3 to your computer and use it in GitHub Desktop.
var _document = $(document);
_document.on("click", ".tabs__menu-link", function (e) {
e.preventDefault();
var _this = $(this),
tabs = _this.closest(".tabs"),
allTabsMenuItems = tabs.find(".tabs__menu-item"),
allTabsContentItems = tabs.find(".tabs__content-item");
allTabsMenuItems.removeClass("tabs__menu-item_active");
_this.parent().addClass("tabs__menu-item_active");
allTabsContentItems.removeClass("tabs__content-item_active animated fadeIn");
allTabsContentItems.eq(_this.parent().index()).addClass("tabs__content-item_active animated fadeIn");
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment