0
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>
<div class="slide">
<img class="fade" src="http://funerariasaopedro.net.br/novo/_img/_banner/_site/bg_2.jpg" />
<span>Este é 2</span>
</div>
<nav>
<button class="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 walk ONLY as divs
whose class is .slide
.
Can’t get to run on the tag NAV.
But it seems that the jQuery is setting the object NAV
also for the class .slide
.
How do we fix this? My impression is that
$(active). next(). length
It will always be true because there is no comparison with .slide
to know what has div.slide
Be sure to finish or give feedback on your questions. This is important for the community.
– Sam
Most of your questions are without appointments with a correct answer. This is not interesting for the community. This means that you ask questions, get answers and do not finish or mark any as correct, or do not seek to solve... this runs away from the purpose of the site. Review your questions and try to solve them.
– Sam
In addition, abandoning questions is bad for both the community and those who tried to answer it. Review this.
– Sam
This question is being debated at the goal: https://pt.meta.stackoverflow.com/q/7041/132
– Victor Stafusa
I agree with you. I’m sorry. my mistake. I corrected it. I chose an answer that, for me, was easier to understand. But thanks for the guidance. It won’t happen again.
– Carlos Rocha