Here is my code:
var $cur = 0;
$(document).ready(function (e) {
$tot = document.getElementsByTagName("img").length;
changetile();
});
function changetile() {
if ($cur == $tot) {
$next = 1;
} else {
$next = $cur + 1;
}
$("#tile-" + $cur).fadeOut(1000);
$("#tile-" + $next).fadeIn(1000);
$cur = $next;
}
var myVar = setInterval(function () {
changetile()
}, 4500);
This code does not work in Chrome (it works the first time). What can I do to fix it?