and thanks in advance for any help.
I have the simple script below to perform a click or the right arrow of a slider (to show the next slide):
<script>
// Simulate click function
function clickButton() {
document.querySelector('.slick-next').click();
}
// Simulate a click every second
setInterval(clickButton, 4000);
</script>
The problem is that I must prevent the slider from advancing when the mouse is over the slider. My slider has the class ".product-carousel" and the right arrow has the class ".slick-next".
In plain English I'm looking for something like:
If the mouse is over the slider {
do nothing
}
else {
click on the right arrow every 4 seconds.
}
And then, too make things even more complicated, I need to change the speed in larger screens (because the slider shows 4 pictures on desktops and users need more time to see them all), so, on top of the mouseover problem I have the screen resolution problem.
Again, in plain English this is my goal:
If the mouse (or finger) is over the slider {
do nothing
}
else {
if resolution is smaller than or equal to 1024px {
click on the right arrow every 4 seconds.
}
else {
click on the right arrow every 7 seconds.
}
}
Any help will be greatly appreciated.