Reputation: 1438
I found this 3D cube animation slider. The problem with this slider is that it needs to click to see the next picture. I want auto silder. All the 4 images should slide automatically and when the image is 4 then the next image will be image 1 again.
$("#controls").on('click', 'span', function(){
$(".cubeSpinner").css("transform","rotateY("+($(this).index() * -90)+"deg)");
});
I am new to programming. Can anyone help me how to customize this make it auto slider without clicking the images?
Upvotes: 1
Views: 293
Reputation: 3395
Another way is to trigger click.
var count=0;
var len = $('#controls span').length;
setInterval(function(){
if(count === len){
count = 0;
}
$('#controls span').eq(count).trigger('click');
count++;
}, 5000);
Upvotes: 0
Reputation: 15992
Try this.
Change your javascript to this.
var index = 0;
setInterval(function(){
if(index==3)
index = 0;
$(".cubeSpinner").css("transform","rotateY("+(index * -90)+"deg)");
index++;
},1500);
Upvotes: 2