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.
精彩评论