Home > DeveloperSection > Articles > JQuery animate method

JQuery animate method

JQuery JQuery 
0 Comment(s)
 6080  View(s)
Rate this:

Using JQuery animate method

With the help of animate () method we can create animation effects on html page .In this article I am using animate method to give animation effect on image. It means image height and width will be resized when mouse pointer will over on image as shown below:




    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

   <script type="text/javascript">

       $(document).ready(function()       {

           $("div").mouseover(function()//mouseover function will execute when mouse pointer will reach on <div>element


               $("img").animate({ height: 300 }, "slow");//image height will change by using animate method

               $("img").animate({ width: 300 }, "slow");     

   $("img").animate({ height: 100 }, "slow");

               $("img").animate({ width: 100 }, "slow







<div  style=" height:100px;width:100px;position:relative"> <img src="Lighthouse.jpg" id="img" style=" height:100px;width:100px;position:relative" </div>




JQuery animate method

Image height and width will change when mouse pointer will over on image as shown below:


JQuery animate method

Don't want to miss updates? Please click the below button!

Follow MindStick