B2B WHOLESALE
Updated version for 10 image banners with:
Replace image URLs with your own:
.ls-header-slider{
width:100%;
overflow:hidden;
}
.ls-slider-wrapper{
position:relative;
width:100%;
aspect-ratio:1920 / 600;
overflow:hidden;
}
.ls-slide{
display:none;
width:100%;
height:100%;
}
.ls-slide.active{
display:block;
animation:fade .6s;
}
.ls-slide img{
width:100%;
height:100%;
object-fit:cover;
}
@keyframes fade{
from{
opacity:.3;
}
to{
opacity:1;
}
}
/* arrows */
.ls-prev,
.ls-next{
position:absolute;
top:50%;
transform:translateY(-50%);
background:rgba(0,0,0,.45);
color:white;
border:0;
padding:12px 18px;
font-size:30px;
cursor:pointer;
z-index:10;
}
.ls-prev{
left:20px;
}
.ls-next{
right:20px;
}
/* dots */
.ls-dots{
position:absolute;
bottom:15px;
width:100%;
text-align:center;
}
.dot{
width:12px;
height:12px;
background:white;
opacity:.5;
border-radius:50%;
display:inline-block;
margin:5px;
cursor:pointer;
}
.dot.active{
opacity:1;
}
/* mobile */
@media(max-width:768px){
.ls-slider-wrapper{
aspect-ratio:1920 / 850;
}
.ls-prev,
.ls-next{
font-size:20px;
}
}
(function(){
let slides=document.querySelectorAll(".ls-slide");
let dots=document.querySelectorAll(".dot");
let current=0;
function showSlide(index){
slides.forEach(slide=>{
slide.classList.remove("active");
});
dots.forEach(dot=>{
dot.classList.remove("active");
});
slides[index].classList.add("active");
dots[index].classList.add("active");
current=index;
}
document.querySelector(".ls-next").onclick-removed=function(){
current++;
if(current >= slides.length){
current=0;
}
showSlide(current);
};
document.querySelector(".ls-prev").onclick-removed=function(){
current--;
if(current < 0){
current=slides.length-1;
}
showSlide(current);
};
dots.forEach((dot,index)=>{
dot.onclick-removed=function(){
showSlide(index);
}
});
// AUTO PLAY 5 SECONDS
setInterval(function(){
current++;
if(current >= slides.length){
current=0;
}
showSlide(current);
},5000);
})();
Updated for Lightspeed header slider banner size: 1920px × 600px (wide hero banner). I changed:
1920 × 60016 / 5
.ls-header-slider{
width:100%;
overflow:hidden;
}
.ls-slider-wrapper{
position:relative;
width:100%;
aspect-ratio:1920 / 600;
overflow:hidden;
}
.ls-slide{
display:none;
width:100%;
height:100%;
}
.ls-slide.active{
display:block;
animation:fade .6s;
}
.ls-slide img{
width:100%;
height:100%;
object-fit:cover;
}
@keyframes fade{
from{
opacity:.4;
}
to{
opacity:1;
}
}
/* arrows */
.ls-prev,
.ls-next{
position:absolute;
top:50%;
transform:translateY(-50%);
background:rgba(0,0,0,.45);
color:white;
border:none;
padding:12px 18px;
font-size:28px;
cursor:pointer;
z-index:5;
}
.ls-prev{
left:20px;
}
.ls-next{
right:20px;
}
/* dots */
.ls-dots{
position:absolute;
bottom:18px;
width:100%;
text-align:center;
}
.dot{
height:12px;
width:12px;
background:#fff;
opacity:.5;
border-radius:50%;
display:inline-block;
margin:5px;
cursor:pointer;
}
.dot.active{
opacity:1;
}
/* mobile */
@media(max-width:768px){
.ls-slider-wrapper{
aspect-ratio:1920 / 800;
}
.ls-prev,
.ls-next{
font-size:20px;
padding:8px 12px;
}
}
(function(){
let slides=document.querySelectorAll(".ls-slide");
let dots=document.querySelectorAll(".dot");
let current=0;
function showSlide(i){
slides.forEach(s=>s.classList.remove("active"));
dots.forEach(d=>d.classList.remove("active"));
slides[i].classList.add("active");
dots[i].classList.add("active");
current=i;
}
document.querySelector(".ls-next").onclick-removed=function(){
current++;
if(current>=slides.length){
current=0;
}
showSlide(current);
};
document.querySelector(".ls-prev").onclick-removed=function(){
current--;
if(current<0){
current=slides.length-1;
}
showSlide(current);
};
dots.forEach((dot,index)=>{
dot.onclick-removed=function(){
showSlide(index);
}
});
// autoplay every 5 seconds
setInterval(()=>{
current++;
if(current>=slides.length){
current=0;
}
showSlide(current);
},5000);
})();
