I've just taken another look and it is actually fading the rest of the images, all at the same time. It seems to me the loop is running, but doesn't wait for the first image to finish fading, would using setTimeout doing anything?

evo wrote:
Hi Guys,

I'm having some trouble looping through images by fading one into the
next.

This is the jQuery

$("ul.list li a").bind("mouseenter", function () {

        var a;
        var max_img = $(this).children().size();
        for(a=0;a<=max_img;a++)
        {

        $(this).children("img").eq(a).next().fadeIn(3000)
        } //end of for-loop


});

and the html is this

<ul class="list">
<li><a href="#">
<img src="assets/images/portfoliostrip/testimg.gif" alt="test"
width="74" height="42"style="display:block;" />
<img src="assets/images/portfoliostrip/testimg1.gif" alt="test"
width="74" height="42" style="display:none;" />
<img src="assets/images/portfoliostrip/testimg2.gif" alt="test"
width="74" height="42 style="display:none;" />
</a></li>
</ul>

These images will be pulled from a database, and I don't know how many
there will be.

Right now, when I hover over the image, it just fades in the last
image in the list.

Can anyone explain why this isn't working and maybe post some code
that will please.

Thanks,
Liam

Reply via email to