This article mainly introduces how to implement animation effects similar to animations in jquery in javascript. The example shows how to simulate animation effects in jQuery using javascript, which has some reference value, if you need it, refer to the following example to describe how to implement animation effects similar to animate in jquery in js. Share it with you for your reference. The specific analysis is as follows:
This instance allows you to move the mouse up. The width changes first, the height changes, the transparency changes, and the mouse moves out.
Key Aspect 1:
startrun(obj,attr,target,fn)box.onmouseover = function(){startrun(box,"width",200,function(){startrun(box,"height",200,function(){startrun(box,"opacity","100")});});}
As shown above, the function can also be used as a parameter to achieve the effect of executing an action first and then executing an action.
Key Aspect 2:
if(cur == target){clearInterval(obj.timer);if(fn){fn();}}
When the Movement reaches the target point, close the timer and then you can execute the new function.
Finally, run the following code:
Untitled documentScript
Script
I hope this article will help you design javascript programs.