开发者

Fading all images with Jquery

开发者 https://www.devze.com 2023-03-16 22:14 出处:网络
I am trying to fade out all my images within a table with Jquery. The following seems not to work.Maybe a syntax error?

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

精彩评论

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