I've just started working with JQuery and I'm having trouble figuring out how to prevent my jquery and css slideshow from continuously looping. Below is the code snippet:
HTML:
<div id="slideshow">
<div>
<img src="Slide1.gif">
</div>
<div>
<img src="Slide2.gif">
</div>
<div>
<img src="Slide3.gif">
</div>
</div>
CSS:
#slideshow {
margin: 50px auto;
position: relative;
width: 755px;
height: 410px;
padding: 10px;
box-shadow: 0 0 20px rgba(0,0,0,0.4);
}
#slideshow > div {
position: absolute;
top: 10px;
left: 10px;
right: 10px;
bottom: 10px;
}
jQuery:
$("#slideshow > div:gt(0)").hide();
setInterval(function() {
$('#slideshow > div:first')
.fadeOut(2000)
.next()
.fadeIn(2000)
.end()
.appendTo('#slideshow');
}, 3000);
I'm looking for some assistance on this issue. Any advice or help would be greatly appreciated. Thank you in advance.