Being a beginner in HTML, CSS, and JavaScript, I am eager to incorporate a smooth slideshow on my website using jQuery or JavaScript. At the moment, my code looks like this, but I am struggling with implementing jQuery.
<div class="col-md-6">
<div class="story_image wow slideInLeft" data-wow-duration="2s">
<img src="images/1.jpg" alt="" class="mySlides">
<img src="images/2.jpg" alt="" class="mySlides">
<img src="images/3.jpg" alt="" class="mySlides">
<img src="images/4.jpg" alt="" class="mySlides">
<img src="images/5.jpg" alt="" class="mySlides">
</div>
</div>
Here is how I currently use JavaScript:
var myIndex = 0;
carousel();
function carousel() {
var i;
var x = document.getElementsByClassName("mySlides");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
myIndex++;
if (myIndex > x.length) {myIndex = 1}
x[myIndex-1].style.display = "block";
setTimeout(carousel, 3000); // Change image every 2 seconds
}