This article mainly introduces how to implement full-screen floating Advertisements based on javascript, and stop moving the cursor floating advertisements, which has a certain reference value, if you are interested, you can refer to the examples in this article to share with you how javascript achieves full-screen floating advertisements for your reference. The specific content is as follows:
Main usage
Visible area width of the webpage: document. body. clientWidth;
Visible area height: document. body. clientHeight;
Visible area width of the webpage: document. body. offsetWidth (including the width of the edge );
Visible area height of the webpage: document. body. offsetHeight (including the width of the edge );
SetInterval
The setInterval action is used to call a function, method, or object every certain time when an animation is played. You can use this action to update the variables or update time display from the database.
The syntax format of the setInterval action is as follows:
setInterval(function,interval[,arg1,arg2,......argn]) setInterval(object,methodName,interval[,arg1,arg2,.....argn])
The first format is the default syntax of the setInterval function in the standard action panel, and the second format is the method used in EXPERT mode actions.
The Parameter function is a function name or a reference to an anonymous function.
The object parameter specifies the Object derived from the object. MethodName specifies the method to be called in the object parameter.
Interval specifies the time between two calls to a function or methodName, in milliseconds. The following arg1 and so on are optional parameters used to specify the parameters passed to the function or methodName.
SetInterval: the time interval set by setInterval is smaller than the animation frame rate (for example, 10 frames per second, equivalent to 100 milliseconds), and the function is called at the interval as close as possible to interval. The updateAfterEvent action must be used to ensure that the screen is refreshed at sufficient frequency. If interval is greater than the animation frame speed, it is called only when the playback header enters a certain frame to reduce the impact of screen refreshing.
ClearInterval
The clearInterval action is used to clear the call to the setInterval function.
Its Syntax format is as follows:
ClearInterval (intervalid); // intervalid is the object returned after the setInterval function is called.
Advertisement mobile effect instance
Simple JS animation instance advertisement moving Effect Mobile Advertisement