I wanted to create a slideshow with some images inside a div. The slides will change continuously on hover over the slide. The div will appear in a position at the top-left corner of the webpage. There are other divs and functionalities in the web page as well.
I used this section of code inside the div for slideshow. It works when hover over the dots. I want it to happen when I hover over slide as well. I have used onmouseover inside div, but it isn't working. How can I do that?
The rest classes are just for positioning and size of the div.
html
<div role="list" class="banner__list w-dyn-items">
<div style="background-image:url(/frontEnd/5a10aaa4d85f4b0001a5419a_2017-lamborghini-huracan- spyder-orange-exterior-front-angle-royalty-exotic-cars.jpg)" role="listitem" class="banner__item w-dyn- item mySlides" onmouseover="currentSlide(1)">
</div>
<div style="background-image:url(/frontEnd/5a10aaa4d85f4b0001a541d8_2015-bentley-continental-gtc- red-car-hero-2-image-royalty-exotic-cars.jpg)" role="listitem" class="banner__item w-dyn-item mySlides" onmouseover="currentSlide(2)">
</div>
<div style="background-image:url(/frontEnd/5abda7fc38a916291e1647d3_2018-jeep-wrangler-white-isolated-front-angle-royalty-exotic-cars.jpg)" role="listitem" class="banner__item w-dyn-item mySlides" onmouseover="currentSlide(3)">
</div>
<span class="dot" onmouseover="currentSlide(1)"></span>
<span class="dot" onmouseover="currentSlide(2)"></span>
<span class="dot" onmouseover="currentSlide(3)"></span>
</div>
javascript
var slideIndex = 1;
showSlides(slideIndex);
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("dot");
if (n > slides.length) {
slideIndex = 1
}
if (n < 1) {
slideIndex = slides.length
}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex - 1].style.display = "block";
dots[slideIndex - 1].className += " active";
}
Currently slide changes when I hover over the dots. I want the slide to continuously go to the next slide as long as that hover is maintained over the slide as well. How can I do that?