I have the following jQuery code:
var id_atual
var temp_id
var tempo_flash = 50
var $slide_atual = $('#slider .atual')
var $slide_prox = $('#slider .ocultar')
setInterval(function(){
id_atual = $slide_atual.attr('alt')
$.post('get_banner.php', {atual: id_atual}, function(proximo){
temp_id = proximo.split(';;')
$slide_prox.attr('src', temp_id[0]).load(function(){
$slide_atual.hide('fade', tempo_flash, function(){
$slide_atual.attr('alt', temp_id[1]).attr('src', temp_id[0]).load(function(){
$slide_atual.show('fade', tempo_flash)
})
})
})
})
}, 4000)
And the following HTML code:
<div id="slider">
<img src="imagens/slider/imagen-slider.jpg" alt="1" class="atual"/>
<img src="" alt="" class="ocultar" />
</div>
Where the class .ocultar have a
display: none;
The vars tempo_flash is only the animation time, and the file get_banner.php is only for getting the next banner from the mysql database. It is tested and working fine.
The problem I have is that after a little (4 or 5 banner changing) the browser stops answering (for Firefox Chrome and Opera) and on IE I get an alert Stack overflow at line: 3
and the javascript of the whole page stops working.
Any help appreciated!