jQuery fade out variable and element by class
Anyway to include both in a function? I imagined this would work, but it di开发者_Go百科dn't
var slide = $('.z:visible'),
next = slide.next();
$(next, '.h').fadeOut(400);
//as opposed to next.fadeOut(400); $('.h').fadeOut(400);
This is accomplished with the add
method:
var slide = $('.z:visible');
slide.next().add('.h').fadeOut(400);
精彩评论