I need to .slideToggle() two div simultaneous.
In order to do it, I used .add() to add the elements into array and apply .slideToggle() on both of them in the same time.
When I tested my code I figured something works suspiciously.
I went down to the bottom of the problem and I was able to figure that the .add() caused the problem – no Idea why.
Anyway, here’s jsfiddle so you can see what I am talking about (you need to change the javascript to test both [the right way and the bugged one]).
Generally I can use the working method but I really want to understand why the .add() doesn’t work as it should…
You’re passing
changeItemsas callback only on one call in the working example.And you’re calling it twice by using
jQuery.addand thenslideToggle.