Infinite horizontal slider
How do I make an infinite horizontal slider?
What is a infinite horizontal slider? How do you make a infinite horizontal slider? This script and codes were developed by Eddy on 27 August 2022, Saturday.
Infinite horizontal slider - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Infinite horizontal slider</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="carousel"> <div class="carousel-inner"> <div id="a" class="item">a</div> <div id="b" class="item">b</div> <div id="c" class="item">c</div> <div id="d" class="item">d</div> <div id="e" class="item">e</div> <div id="f" class="item">f</div> <div id="g" class="item">g</div> <div id="h" class="item">h</div> <div id="i" class="item">i</div> </div>
</div> <script src="js/index.js"></script>
</body>
</html>
Infinite horizontal slider - Script Codes CSS Codes
.carousel { position: relative; width: 600px; height: 150px; margin: 0 auto; overflow: hidden; } .carousel-inner { position: absolute; /*width: 600px;*/ height: 150px; } .item { width: 150px; height: 150px; padding-top: 35px; float: left; text-align: center; font-size: 60px; }
Infinite horizontal slider - Script Codes JS Codes
var firstval = 0;
var pageSize = 600;
var page = 0;
function runCarousel(carousel, elementcount, elementPerPage, timer) { if(page >= Math.round(elementcount/elementPerPage)) { page = 0; firstval = 0; parent.style.left = 0; } firstval += 5; parent = carousel.querySelector('.carousel-inner'); parent.style.left = "-" + firstval + "px"; if (!(firstval % pageSize)) { setTimeout(function() {runCarousel(carousel, elementcount, elementPerPage, timer)}, timer); page += 1; return; } setTimeout(function() {runCarousel(carousel, elementcount, elementPerPage, timer)}, 20);
} var elementcount = document.querySelector('.carousel').querySelector('.carousel-inner').querySelectorAll('.item').length;
runCarousel(document.querySelector('.carousel'), elementcount, 4, 3000);
Developer | Eddy |
Username | emnbdx |
Uploaded | August 27, 2022 |
Rating | 3 |
Size | 2,009 Kb |
Views | 32,384 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
LBCA - Mail canvas | 3,856 Kb |
HA - proto invitation | 3,534 Kb |
HA - proto evt widget | 3,071 Kb |
HA - story | 5,184 Kb |
HA - proto notif | 2,781 Kb |
Google autocomplete test | 2,854 Kb |
Nice social button | 2,871 Kb |
HA - radio checkbox mix | 2,270 Kb |
Tip joke | 1,780 Kb |
LBCA - tile test | 3,496 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
A Pen by lizz | Lizz | 10,068 Kb |
Sort the Knowlege | Eprouver | 3,915 Kb |
TimelineMax Circular loader | Nicolund | 2,649 Kb |
Brent Burns Tribute Page | Nevada48 | 2,569 Kb |
Loading Bar | Jaradlight | 2,333 Kb |
Bootstrap Carousel Fade Transition | Rowno | 2,484 Kb |
Polo, the flying squirrel | Agbales | 2,445 Kb |
Animate elements with fixed gradient | Badabam | 4,406 Kb |
Pure CSS albums gallery | Renaudtertrais | 2,978 Kb |
Responsive slide | Thorien | 2,400 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!