Skip to content

Instantly share code, notes, and snippets.

Created February 10, 2014 08:28
Show Gist options
  • Save anonymous/8912275 to your computer and use it in GitHub Desktop.
Save anonymous/8912275 to your computer and use it in GitHub Desktop.
.tab{float:left; width:32px; height:32px; background:#FFFFFF;}
.tab:hover{background:#F7F7F7;}
.tab.active{background:#01A1DC; color:#FFFFFF;}
.tab-content{display:none; float:left; width:300px; height:200px; background:#FFFFFF; border:1px solid #d8d5d6;}
.tab-content.active{display:block;}
<!DOCTYPE html>
<html>
<head>
<script src="http://jashkenas.github.com/coffee-script/extras/coffee-script.js"></script>
<meta charset=utf-8 />
<title>Welcome to JS Bin</title>
<meta name="viewport" content="width=device-width">
<link href='http://fonts.googleapis.com/css?family=Doppio+One' rel='stylesheet' type='text/css'>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</head>
<body>
<div class="drop-up">
<div class="tab-content active">Content 1</div>
<div class="tab-content">Content 2</div>
<div class="tab-content">Content 3</div>
<div class="tab-content">Content 4</div>
<div class="tab-content">Content 5</div>
<div class="tab active">1</div>
<div class="tab">2</div>
<div class="tab">3</div>
<div class="tab">4</div>
<div class="tab">5</div>
</div>
</body>
</html>
$('.tab').click(function(){
$('.tab, .tab-content').removeClass('active');
$(this).addClass('active');
var i = $(this).index('.drop-up .tab');
$('.tab-content').eq(i).addClass('active');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment