Skip to content

Instantly share code, notes, and snippets.

@chickenfoot88
Forked from serj08/index.html
Created January 27, 2017 13:08
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 chickenfoot88/e3f08c98680895ee2065bd84badd8616 to your computer and use it in GitHub Desktop.
Save chickenfoot88/e3f08c98680895ee2065bd84badd8616 to your computer and use it in GitHub Desktop.
jQuery Tabs Short by agragregra
<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 { 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