Created
December 31, 2016 11:03
-
-
Save Titoratus/8b1103ad34e610fb1083ea9f08ec7d8a to your computer and use it in GitHub Desktop.
JQuery 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
<div class="wrapper"> | |
<div class="tabs"> | |
<span class="tab">Вкладка 1</span> | |
<span class="tab">Вкладка 2</span> | |
<span class="tab">Вкладка 3</span> | |
</div> | |
<div class="tab_content"> | |
<div class="tab_item">Содер. 1</div> | |
<div class="tab_item">Содер. 2</div> | |
<div class="tab_item">Содер. 3</div> | |
</div> | |
</div> | |
$(".wrapper .tab").click(function(){ | |
$(".wrapper .tab").removeClass("active").eq($(this).index()).addClass("active"); | |
$(".tab_item").hide().eq($(this).index()).fadeIn() | |
}).eq(0).addClass("active"); | |
.wrapper .active { text-decoration: underline; } | |
.tab_item { display: none; } | |
.tab_item:first-child { display: block; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment