After a few cycles, the timer begins to slow down, what could be the reason? Initially, I do so that after a certain period of time, pictures appear in one or another row, but after several cycles the timer is lost. What could be the reason ?
Here is the code:
var fn = function() { function animation_zone() { tgl++; if (tgl == 1) { $("div").fadeOut("0", function() { $("div").fadeOut("1000", function() { $("div").fadeIn("1000"); }); }); $("div").fadeOut("1000", function() { $("div").fadeIn("1000"); setTimeout(function() { $("div").fadeIn("1000", function() {}) }, 7000) }); } if (tgl == 2) { $("div").stop().fadeOut("0", function() { $("div").fadeOut("1000", function() { $("div").fadeIn("1000"); }); }); $("div").fadeOut("1000", function() { $("div").fadeIn("1000"); }); setTimeout(function() { $("div").fadeIn("1000"); }, 7000) tgl = 0; } } animation_zone(); setTimeout(arguments.callee, 14300); } setTimeout(fn, 14300);