How to make jquery slider to start afresh
Question
I would want to have the below setinterval() to start afresh once the last slide is reached, am having three div and but the slide stops once it reaches the third div, i would want it to start again from the first.
My Html code
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<script src="jquery.min.js"></script>
<script src="myjava.js"></script>
</head>
<body>
<div class="container">
<div id="slide1" class="slider1">My first slide goes here</div>
<div id="slide2" class="slider2">My second slide goes here</div>
<div id="slide3" class="slider3">My third slide goes here</div>
And my Java code Below
jQuery(function($){
var currentDIV = $("#slide1");
var nextDIV, count = 1;
var myInterval = setInterval(function(){
currentDIV.hide();
currentDIV = currentDIV.next();
currentDIV.show();
}, 2000);
});
0
css, html, jquery, slideshow
3 years
2020-06-11T13:10:20-05:00
2020-06-11T13:10:20-05:00 0 Answers
97 views
0
Leave an answer