Reputation:
I'm really new in JavaScript. I want something like this:
$(document).ready(function () {
var cur = -1;
//while (true) {
// $('.slider .cadr').eq(cur).fadeOut();
// cur += 1;
// $('.slider .cadr').eq(cur).fadeIn();
//
// delay(); // how do I do this?
//}
});
So how do I delay? Please fix my jsfiddle: http://jsfiddle.net/SpyZF/
Upvotes: 1
Views: 84
Reputation: 30453
There something like setInterval
function instead of it. See demo: http://jsfiddle.net/wxkhH/
Syntax:
setInterval(function, number);
And you should do
el1.fadeOut(function () {
el2.fadeIn();
});
Other way they will start at the moment.
And if you want it goes cyclical, then use cur = (cur + 1) % 4;
Upvotes: 1