Last active
July 4, 2017 19:04
-
-
Save serj08/a6e5207998fb60b606e7ad1ae9e6acae to your computer and use it in GitHub Desktop.
jQuery Tabs Short by agragregra
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> |
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
$(".wrapper .tab").click(function() { | |
$(".wrapper .tab").removeClass("active").eq($(this).index()).addClass("active"); | |
$(".tab_item").hide().eq($(this).index()).fadeIn() | |
}).eq(0).addClass("active"); |
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
.wrapper .active { color: red; } | |
.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