Js implements a simple example of fixed advertising effects on both sides of the left and right, and js on both sides of the left and right
This article describes how to implement a simple fixed advertising effect between the left and right sides of JavaScript. Share it with you for your reference. The specific analysis is as follows:
Most websites have fixed advertising spaces on both sides. below is the simplest code to achieve this effect. It may be a little jitters when I scroll under ie. This problem will be solved later, first.
Key Aspect 1:
var adtop = adleft.offsetTop;
Obtain the position of the element above the distance, which must be used for scrolling.
Key Aspect 2:Copy codeThe Code is as follows: adleft.style.top?adtop=(document.doc umentElement. scrollTop | document. body. scrollTop) + "px"; When scrolling, assign a value to the top position of the element to the distance between the element itself and the scroll distance.
Code:
<! DOCTYPE html>
I hope this article will help you design javascript programs.