jQuery addClass example

Change class name on click in jQuery

by Viktor

HTML

<div class="wrapper">
  <div class="top">
  <button id="poop">
  click
  </button>
  </div>
   <div class="bottom">
   
   </div>
   
</div>

CSS

.top{
  height:500px;
  background-color:red;
}

.bottom{
  height:500px;
  background-color:green;
}

JavaScript

$(function(){
  // find elements
  $("#poop").click(function(){
  	$(".top").animate({height:0}, {step:function( now, fx){
    console.log("step")
    },
    complete:function(){
    console.log("complete");
    }})
  })
})