This article describes how to implement seamless scrolling between multiple images in javascript. It has good reference value. Next, let's take a look at it. This article mainly introduces examples of javascript to achieve seamless scrolling between multiple images. It has good reference value. Let's take a look at it with the small Editor.
Structure: box contains ul, ul contains 4 li; ul is definitely positioned.
Copy li-1, li-2 to the back of the li-4, in order to distinguish between li-1, li-2, content to li-5, li-6, color unchanged. At this time, ul contains 6 li.
Note that the ul box is moved instead of li.
Principle: when ul absolute positioning of the left value is equal to (li-1 + li-2 + li-3 + li-4) width, the use of Javascript to quickly restore the left value is 0.
Pay attention to the changes in numbers and colors in the box!
:
Sample Code:
Document
- Li-1
- Li-2
- Li-3
- Li-4
- Li-5
- Li-6