Answer the question
In order to leave comments, you need to log in
How to make slider autoscroll by class?
How can I auto-scroll a slider? Because the slider is made on html + css, then you need to add auto-scroll every 4 seconds. Is it possible to add a function to the next class using JS? The slider has the following code:
<ul class="slides">
<input type="radio" name="radio-btn" id="img-1" checked="">
<li class="slide-container">
<div class="slide">
<a href="ссылка"><img src="ссылка на баннер"></a>
</div>
<div class="nav">
<label for="img-7" class="prev">‹</label> <label for="img-2" class="next">›</label>
</div>
</li>
</ul>
Answer the question
In order to leave comments, you need to log in
If it’s completely calic, then you can do something like this:
setInterval(function() {
document.getElementsByClassName('next')[0].click();
var slide1 = document.getElementsByClassName('slide-container')[0],
slidesContainer = document.getElementsByClassName('slides')[0];
slidesContainer.appendChild(slide1);
}, 4000);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question