I’ve created a carousel using jQuery and I would like to add auto-play functionality to it.
Here’s my existing JS:
$(document).ready(function (){
$('#button a').click(function(){
var integer = $(this).attr('rel');
$('#myslide .cover').animate({left:-705*(parseInt(integer)-1)})
$('#button a').each(function(){
$(this).removeClass('active');
if($(this).hasClass('button'+integer)){
$(this).addClass('active')}
});
});
});
And here’s a working fiddle.
Question: I have no idea where to start with auto-play. Any suggestions?
check this out:
http://jsfiddle.net/gy7LE/13/