开发者

Fading all images with Jquery

I am trying to fade out all my images within a table with Jquery.

The following seems not to work.Maybe a syntax error?

$(function() {
     $('#myTable img').each(function(index) {
        $(this).fadeOut('slow', functi开发者_如何转开发on() {
    // Animation complete.
       });
    });
});


You only have to do this:

$(function() {
     $('#myTable img').fadeOut('slow', function() {
        // Animation complete.
       });
});

You don't have to use the each method.

And if you want to use the each method, do the following

$(function() {
     $('#myTable img').each(function(index,e) {
        $(e).fadeOut('slow', function() {
       // Animation complete.
       });
    });
});

The e will reference current image.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜