Created
August 12, 2019 12:09
-
-
Save ColtMoney/42b788439010a6ae9c41f129e7ae0ed9 to your computer and use it in GitHub Desktop.
Tabs
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
<ul class="tabs-item"> | |
<li class="active"></li> | |
<li></li> | |
<li></li> | |
<li></li> | |
</ul> | |
<div class="tabs-content-wrap"> | |
<div class="tab-content-item"> | |
</div> | |
<div class="tab-content-item"> | |
</div> | |
<div class="tab-content-item"> | |
</div> | |
<div class="tab-content-item"> | |
</div> | |
</div> |
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
$(".tabs-item li").on("click", function(){ | |
let idx = $(this).index(); | |
$(".tabs-item li").removeClass("active"); | |
$(this).addClass("active"); | |
$(".tab-content-item").hide(); | |
$(".tab-content-item").eq(idx).show(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment