Example analysis of animate usage in jQuery

  • 2020-05-12 02:10:53
  • OfStack

This article illustrates the use of animate in jQuery as an example. Share with you for your reference. The details are as follows:

This is a simple animate function attempt. The code is as follows:


<script type="text/javascript"> 
$(document).ready(function(){ 
  $(".side-box h3").toggle(function(){ 
  $(this).addClass("box-arrow"); 
   $(this).next(".side-text").animate({ 
   height: 'toggle',  
   opacity: 'toggle' 
  }, "slow"); 
  return false; 
 
  },function(){ 
   $(this).next(".side-text").animate({ 
   height: 'toggle',  
   opacity: 'toggle' 
  }, "slow"); 
  $(this).removeClass("box-arrow"); 
  return false; 
  }); 
}); 
</script>

I hope this article has been helpful to your jQuery programming.


Related articles: