JS Set delay:Using setinterval and setting the delay function settimeout very similar. SetTimeout used to delay a period of time before doing an operation.SetTimeout ("function", time) sets a timeout object SetInterval ("function", time) sets a
SetTimeout ()SetTimeout () is the method of window, but we all skip the top-level object name of window. This is used to set a time. When the time is reached, a specified method will be executed. Let's take a look at the next simple example. This is
If window. setTimeout is frequently used on the page, the Code judgment may be confusing.
For example
If (! Timerid)
Timerid = Window. setTimeout (dosomething, duration );
Window. cleartimeout (timerid );
And so on.
Methodqueue is an object used to
First look at the effectDon't talk more about the code ~DOCTYPE HTML>HTML> Head> Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"> title>Timertitle> Scripttype= "Text/javascript"> varNum=0; vari;
Document directory
Use setTimeout to delay function execution
Use clearTimeout to cancel an execution plan
Develop and cancel repeated execution plans for Functions
Use process. nextTick to delay function execution to the next round of the
1, this function is only applicable to the need to automatically fill or narrow the page to the visible area, and only a single subject to change the height of the demand.varResetcontrol =function(ptask) {var_task = Ptask | |[], _islock=false,
RequestAnimationFrame is better than setTimeoutsetInterval because it is an API provided by the browser for animation. At runtime, the browser automatically optimizes the method call. If the page is not activated, the animation will be automatically
Using Requestanimationframe to achieve a good performance JS animation. First give you a brief introduction to the next Requestanimationframe than SetTimeout, setinterval have what advantages?
Example one:
Requestanimationframe has two main
The effect of Ps:flash is much better, but this is not the scope of my research, and there is nothing comparable.
Compatible: IE6/7/8, Firefox 3.5.5, opera 10.01, Safari 4.0.3, Chrome 3.0
Effect Preview
Ps: flash achieves much better results, but this is not the scope of my research and there is no comparability.Compatible with: ie6/7/8, firefox 3.5.5, opera 10.01, safari 4.0.3, chrome 3.0Effect Preview
File Upload
Select File
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.