1
Apparently, the code is correct, it’s as follows:
{
if( $(".ativo").next().size() )
{
$(".ativo").fadeOut().removeClass("ativo").next().fadeIn().addClass("ativo")
}
else
{
$(".ativo").fadeOut().removeClass("ativo");
$("#slide img").eq(0).fadeIn().addClass("ativo")
}
And the current html:
<div id="slide">
<a href="CURSOS.html"><img id="slideIMG1" src="IMAGENS/mao (370px) - Final.jpg" width="1155" height="370" alt=""/></a>
<a href="#"><img id="slideIMG2" src="IMAGENS/picjumbo (370px).jpg" width="1155" height="370" alt=""/></a>
</div>
Where is the
.ativo
in your html? And the image selector is fixed$("#slide img").eq(0)
. You’ll always get the first picture.– DontVoteMeDown
I don’t understand, where in the code above you are "returning" something? By the way, in your last line you use a
eq(0)
, then this selector is filtered to apply only to the first previously selected result (i.e. if"#slide img"
selected two images, theeq(0)
will cause only the first to continue as part of the whole).– mgibsonbr
as @Dontvotemedown said, really eq(0) will only activate the first image, but after all what you want to do with a slide and two images ?
– Thiago Friedman
I don’t understand. Because if there is something after the first one, it is for him to display that something and add the "active" class to that something.
– Harison
ativo
is a class applied to the image itself or link (a
)? If you go toimg
, I think I’ve identified your problem... (no picture therenext
, they are the only daughters of youra
)– mgibsonbr
In case I believe it applies the active class to the same image, according to the selector.
– Harison