I have this HTML
<div class="slider">
<div class="slide ativa">
<img class="fade" src="http://funerariasaopedro.net.br/novo/_img/_banner/_site/bg_1.jpg"/><span>Esteé1</span></div><divclass="slide">
<img class="fade" src="http://funerariasaopedro.net.br/novo/_img/_banner/_site/bg_2.jpg"/><span>Esteé2</span></div><nav><buttonclass="anterior">Anterior</button>
<button class="proximo">Próximo</button>
</nav>
</div>
And this jQuery
$(document).ready(function(e) {
function startslider() {
ativa = $("div.slider div.ativa")
if (!$(ativa).next().length) {
ativa = blocos[0]
}
$(ativa)
.removeClass("ativa")
.next()
.addClass("ativa")
setTimeout(startslider, 5000)
}
setTimeout(startslider, 5000)
})
The idea here is to go through ONLY divs
whose class is .slide
.
You can not run the NAV tag.
But it seems that jQuery is setting the object NAV
also to the class .slide
.
How to fix this? The impression I have is that
$ (active) .next (). length
It will always be true because there is no comparison with .slide
to know that of div.slide