Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
  article, aside, figure, footer, header, hgroup, 
  menu, nav, section { display: block; }
  *{
    margin:0;padding:0;
  }
  
  h2.button{
    cursor:pointer;
    color:#fff;
    background:#444;
    width:300px;
    margin-bottom:1px;
  }
  .box{
    position:relative;
    background:#eee;
    width:280px;
    padding:10px;
  }
  
</style>
</head>
<body>
  
  <h2 class="button">Open 1</h2>
  <div class="box">Box 1</div>
  
  
  <h2 class="button">Open 2</h2>
  <div class="box">Box 2</div> 
  
    <h2 class="button">Open 3</h2>
  <div class="box">Box 3</div> 
  
  
</body>
</html>
 
$('.box').hide();
$('.button').click(function(){
  var box = $(this).next();
  box.is(':visible') ? box.slideToggle() : ($('.box').slideDown(), box.slideUp()); 
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers