Currently, I am in the process of creating a slider from scratch. Although there are ready-made plugins available for this purpose, my goal is to understand the underlying logic by building it myself. So far, I have managed to piece together most of the components, except for the part where I want the slider to loop back to the beginning once it reaches the last slide.
If you'd like to take a look at my progress so far, here is a link to a CodePen: https://codepen.io/alexyap/pen/zwoRMy
$(document).ready(function(){
function slide() {
setTimeout(function(){
$("#container").addClass("slide-left1")
}, 3000);
setTimeout(function(){
$("#container").addClass("slide-left2")
}, 9000);
}
slide();
My objective now is to create a loop within my sliding mechanism. I am considering utilizing the setTimeout functions to achieve this, allowing each slide to pause briefly both after page load and on specific slides. This will give visitors ample time to read any content present on each slide. Any assistance or guidance on how to accomplish this would be greatly appreciated. Thank you in advance!