This article mainly introduces jQuery animation effects to achieve seamless and continuous scrolling of images, and to implement continuous and uninterrupted scrolling advertising spaces, interested parties can refer to the examples in this article to introduce the detailed code for seamless and continuous image scrolling using jQuery animation effects. The details are as follows:
As follows:
I. HTML code
1. p with the id of container is the packaging of the outermost layer, which is used to control the specific position displayed in the rolling area.
2. ul with the id of content is used to wrap the pictures that need to be rolled.
3. The li element is used to wrap a specific image.
Ii. CSS code
*{margin: 0; padding: 0;} img{ border:0; } #container{ width:800px; height: 130px; margin:100px auto; border:3px solid blue; overflow: hidden; position: relative; } #container ul{ list-style: none; width:10000px; position: absolute; } #container ul li{ float:left; margin-right: 20px; }
Here, we will explain why ul's width is set to pixel PX. Because the implementation principle of seamless continuous scrolling is to clone a copy of the existing displayed image and splice it behind the displayed image, the total width of the displayed image is unknown, to ensure security, we recommend that you set the width of ul to a greater value.
Iii. Analysis on the principle of seamless Continuous Rolling
Iv. JQuery implementation code