Infinite Carousel

Developer
Size
2,478 Kb
Views
42,504

How do I make an infinite carousel?

Straightforward looping card set. Just like Teehan + Lax.. What is a infinite carousel? How do you make a infinite carousel? This script and codes were developed by Insprd on 13 September 2022, Tuesday.

Infinite Carousel Previews

Infinite Carousel - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Infinite Carousel</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id='profiles'> <div class='carousel'> <div class='member'> 1 </div> <div class='member'> 2 </div> <div class='member'> 3 </div> <div class='member'> 4 </div> <div class='member'> 5 </div> <div class='member'> 6 </div> <div class='member'> 7 </div> <div class='member'> 8 </div> <div class='member'> 9 </div> </div> <button id='prev'> &#9664; </button> <button id='next'> &#9654; </button>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Infinite Carousel - Script Codes CSS Codes

#profiles {	max-width:800px;	height:430px;	background: #eee;	position:relative;
}
.carousel { position:relative; overflow:hidden;	height:300px;	background:#ddd;	top:20px;	white-space:nowrap;	font-size:0;
}
.member {	font-size:16px;	display:inline-block;	border-left:1px solid #aaa; box-sizing:border-box; -moz-box-sizing:border-box; -webkit-box-sizing:border-box; /* prevents border from increasing .member width */	width:260px; /* See jQ */	height:300px;	background:#ccc;
}
.member:first-child {	margin-left:20px; /* 20+20 - 300 = */
}
#prev, #next {	position:absolute; padding:30px;	margin:15px;	bottom:0;
}
#prev {left:0; }
#next { right:0; }
/* for demo purposes*/
#profiles {
margin:50px auto;}

Infinite Carousel - Script Codes JS Codes

var $s = $(".carousel"), $b = $('#prev, #next'),	$d = function(fl){return $('>div',$s)[fl]();}, px = 260; // Animation px
$s.prepend( $d('last') ).scrollLeft( px ); // Prepend last element and reset pos to '1'.
$b.click(function() {	if( !$s.is(':animated')){	if(this.id=="next") $s.animate({scrollLeft:px*2}, 400, function() {	$s.scrollLeft(px).append($d('first'));	});	else $s.prepend($d('last')).scrollLeft(px*2).animate({scrollLeft:px}, 400);	}
});
Infinite Carousel - Script Codes
Infinite Carousel - Script Codes
Home Page Home
Developer Insprd
Username insprd
Uploaded September 13, 2022
Rating 3
Size 2,478 Kb
Views 42,504
Do you need developer help for Infinite Carousel?

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!

Insprd (insprd) Script Codes
Create amazing web content with AI!

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!