Effect Preview Ideas
Problem 1. How to implement infinite carousel? The problem is that when the list scrolls to the end, there will be blank space (extra space) at the bottom. How to deal with it? 2. How to let users switch back to the first item without noticing? After adding the duplicate items, control the switching timing and switch immediately when the list scrolls to the end of the last item (the beginning of the first item of the duplicate item). For example: Code <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Infinite scrolling list</title> </head> <style> .container { position: relative; background-color: #a4ffcc; /* The parent container needs to have a clear height */ height: 150px; width: 200px; margin: auto; overflow: hidden; } .container > .scroll-list { position: absolute; top: 0; left: 0; width: 100%; animation: scroll 6s linear infinite normal; } .container > .scroll-list > div { width: 100%; /* The scrollable item needs to have a specific height */ height: 30px; background-color: #1ea7ff; display: flex; justify-content: center; align-items: center; color: white; } .container > .scroll-list > div:nth-child(2n) { background-color: #18d9f8; } @keyframes scroll { 100% { /*Total height of content to scroll*/ top: -300px; } } </style> <body> <div class="container"> <div class="scroll-list"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> <div>7</div> <div>8</div> <div>9</div> <div>10</div> <!-- The following code is to allow the scrolling content to display one more screen (remove blank space/infinite carousel): Please calculate the number according to the height--> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> </div> </div> </body> </html> This is the end of this article about how to implement infinite scrolling/carousel of lists with CSS3. For more relevant CSS3 list scrolling and carousel content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! |
<<: How to import CSS styles into HTML external style sheets
>>: A brief summary of how to write paths when HTML files introduce external CSS files
Table of contents Overview 1. Acquisition and pro...
Table of contents The principle and function of l...
Overview binlog2sql is an open source MySQL Binlo...
What is HTML? HTML is a language used to describe...
Table of contents 1 Test Environment 1.1 Server H...
Note: This method is only applicable to webkit-ba...
The Truncate table statement is used to delete/tr...
Today, when I was practicing with the Baidu page,...
Table of contents Prefab How to create a prefab T...
1. Problem Description When starting MYSQL, a pro...
Effect: Code: <template> <div class=&quo...
Find mirror We can search for images from the Doc...
I logged into the backend to check the solution t...
Preface I encountered a Mysql deadlock problem so...
This article records the detailed process of down...