make an element collapse horizontally and then disappear - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:jQuery Method Example

Description

make an element collapse horizontally and then disappear

Demo Code

ResultView the demo in separate window


<html>
 <head> 
  <script src="https://code.jquery.com/jquery-2.0.3.min.js"></script> 
  <style>

#box{//from  ww w  . j a va 2 s . co m
   position:relative;
   width:300px;
   height:100px;
   background:red;
}

      </style> 
 </head> 
 <body> 
  <button>CLICK ME</button> 
  <div id="box"></div> 
  <script>
$('button').click(function(){
  $('#box').animate({width: "toggle" });
});

      </script>  
 </body>
</html>

Related Tutorials