technopeasant
technopeasant

Reputation: 7939

jQuery fade out variable and element by class

Anyway to include both in a function? I imagined this would work, but it didn't

var slide = $('.z:visible'),
    next  = slide.next();

$(next, '.h').fadeOut(400);
//as opposed to next.fadeOut(400); $('.h').fadeOut(400);

Upvotes: 0

Views: 502

Answers (1)

Jon
Jon

Reputation: 437336

This is accomplished with the add method:

var slide = $('.z:visible');
slide.next().add('.h').fadeOut(400);

Upvotes: 2

Related Questions