开发者

How do I reset the jQuery traversal stack to load the elements in order each time?

开发者 https://www.devze.com 2023-04-10 03:13 出处:网络
The example is here on j开发者_JAVA百科sFiddle. If you run the example and hit the next button until you get to the last page. You will see that image #10 loads and is visible and then it only loads

The example is here on j开发者_JAVA百科sFiddle.

If you run the example and hit the next button until you get to the last page. You will see that image #10 loads and is visible and then it only loads image #7, #8 and #9. I also logged it in the console, so you can see that it loads #10, #7, #8, #9 in that order.

I hope this makes sense. Let me know if I can clarify anything.


It's your prependTo call that's causing the elements to jump around. Try changing the list click() function to this:

$('li').click(function() {
    $('.selected').removeClass();
    $(this).addClass('selected');
    $('ul').find('li:not(.selected)').fadeOut('fast');
});

That should get you pretty close.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号