The example in this article describes how jQuery implements the circle animation effect. Share it with everyone for your reference. The details are as follows:
This jQuery implements the circle animation effect. Google’s circle effects are very good. I will imitate them here. Time is limited, and there is still an issue of animation accumulation that has not been solved. Of course, it is based on jQuery, and pure JS does not yet have this capability. Interested friends can try to improve it.
The screenshot of the running effect is as follows:
The specific code is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>jQuery 动画效果 circle</title> <style> body { width:200px; margin:0 auto; margin-top:100px; background:#CCC; } #login{ position:relative; } .circle_l, .circle_b { width:148px; height:148px; border-radius:80px; background:blue; border:1px solid #FFF; } .circle_l { width:138px; height:138px; position:absolute; top:5px; left:5px; } .circle_b { background:lightblue; } </style> <script src="jquery-1.6.2.min.js" type="text/javascript"></script> </head> <body> <div id="login"> <div class="circle_b"> <div class="circle_l"></div> </div> </div> <script type="text/javascript"> $(".circle_b").hover(function(){ $(this).stop().animate({width:188,height:188,marginTop:"-20",marginLeft:"-20"},500) .css({"border-radius":"150px"}); $(".circle_l").stop().animate({marginTop:"20"},500) },function(){ $(this).stop().animate({width:148,height:148,marginTop:"0",marginLeft:"0"},500) .css({"border-radius":"100px"}); $(".circle_l").stop().animate({marginTop:"0"},500) }) </script> </body> </html>
I hope this article will be helpful to everyone’s jquery programming design.