Fading multiple elements simultaneously - jquery

user429620 picture user429620 · Aug 5, 2011 · Viewed 13.2k times · Source

I want to do the following:

$(newPanel, prevBtn, nextBtn, infoPanel).fadeIn(200, function() {
}

these vars are divs created with jquery

but only the first element fades in, I really need all elements to fade in at the same time.

Answer

Guffa picture Guffa · Aug 5, 2011

You can use the add method to get the elements in the same jQuery object:

newPanel.add(prevBtn).add(nextBtn).add(infoPanel).fadeIn(200);