I am new at jQuery and I'm trying to create a slideshow. I created it but when the timer change my picture, all the page seems to be refreshed.
HTML Example:
<div class="slide">
<img id="scroll_image" src="img/rooms/suite5.jpg" width="1000" height="350" alt="hotel-suite-1" class="show" />
<img id="scroll_image" src="img/rooms/suite1.jpg" width="1000" height="350" alt="hotel-suite-2" />
<img id="scroll_image" src="img/rooms/suite2.jpg" width="1000" height="350" alt="hotel-suite-3" />
<img id="scroll_image" src="img/rooms/suite3.jpg" width="1000" height="350" alt="hotel-suite-4" />
<img id="scroll_image" src="img/rooms/suite4.jpg" width="1000" height="350" alt="hotel-suite-5" />
</div><!--end of slide-->
jQuery Example:
$(document).ready(function() {
slideShow();
});
function slideShow() {
var current = $('.slide .show');
var next = current.next().length ? current.next() : current.parent().children(':first');
current.hide().removeClass('show');
next.fadeIn().addClass('show');
setTimeout(slideShow, 6000);
}
You can see what i mean if you click here, scroll down the page and wait for the timer to change the image!?