Skip to content

Instantly share code, notes, and snippets.

@alt-karate
Created April 10, 2019 10:46
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 alt-karate/19f3d5a60967e25c4c3696c839b81888 to your computer and use it in GitHub Desktop.
Save alt-karate/19f3d5a60967e25c4c3696c839b81888 to your computer and use it in GitHub Desktop.
test.js
$(function() {
if ($('#menu')[0]) {
var $tabcontAry = [$('#menuA'), $('#menuB'), $('#menuC')];
$('.menu__tab a').off().on('click', function() {
if (!$(this).hasClass('active')) {
$('.menu__tab a').removeClass('active');
$(this).addClass('active');
var clickdNum = $('.menu__tab a').index($(this));
for (var i = 0; i < $tabcontAry.length; i++) {
$tabcontAry[i].hide();
}
$tabcontAry[clickdNum].fadeIn(200);
}
return false;
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment