Javascript-javascript tips

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.