Answer the question
In order to leave comments, you need to log in
What are the main problems of my wretched slider?
There is a simple version of the slider that scrolls in "real time" one pixel every * milliseconds.
var sliderElement = document.getElementsByClassName('header__slider-ul');
var a = 5;
var slider = setInterval(function() {
a = a-1;
sliderElement[0].style.marginLeft = a + "px";
if (a < -665) {
a = 5;
}
}, 100);
function sliderMouseOut() {
slider = setInterval(function() {
a = a-1;
sliderElement[0].style.marginLeft = a + "px";
if (a < -665) {
a = 5;
}
}, 100);
}
function sliderMouseOver() {
clearInterval(slider)
}
Answer the question
In order to leave comments, you need to log in
First, start using transform.
Then look towards requestAnimationFrame.
And also to understand how transitions work.
Cycling, sir.
Swiper has freemode and in its api you can completely code autoscrolling at the desired speed.
idangero.us/swiper/demos/09-freemode.html
idangero.us/swiper/api
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question