When I was busy I found out that it's not possible to toggle several Div's at once, it is only possible to expand several Div's at once with separated buttons for expanding and collapsing.
I tried something with the javascript but was not able to manage it.
Can someone help me to toggel several Div's at once with the "toggle" function?
Ok, i didn't read the whole tutorial, but from what i can see by just glancing at it, is that the tutorial uses jQuery library, but also a jQuery plugin called animatedcollapse... Is that right?
I don't see the need for that and i have no idea why someone wrote a plugin for doing something that jQuery already has built in. So instead of using that plugin, you can only implement jQuery and then simply achieve this same behavior by calling:
Code:
$("#jason").toggle();
This simple call will toggle a div with id="jason". Toggle means it will show it if hidden, and hide if shown.
Now, if you want to toggle more divs at the same time, you have two choices.
Your first choice:
You will define 3 divs with different id's. First div has id="jason", second has id="david" and third has id="bananas". And then you can call the toggle method on divs with all 3 id's together, like this:
Code:
$("#jason, #david, #bananas").toggle();
Your second choice:
You can drop the id's and use classes instead. Because the HTML specification doesn't allow you to use the same id for more than one element, calling a method on an id will only affect one element. This changes with classes, because you can use the same class on any number of div's.
So again define 3 divs, but give all of them the same class, class="jason". Then call the toggle method on class jason, like this:
Bookmarks