I\'m new to jQuery and javascript in general but am plugging my way through thanks to sites like these.
I have a page with six hidden divs that are called with correspon
The best way would be to use http://api.jquery.com/toggle/
Toggle lets you the animation for one
$('#clickme').click(function() {
$('#book').toggle('slow', function() {
// Animation complete.
});
});
As for truely Shortening the code I would use a class identifier for your panels.
Identify panel groups like
$("#panel3").fadeOut("slow", function() {
$("#panel4").fadeOut("slow", function() {
$("#panel5").fadeOut("slow", function() {
$("#panel6").fadeOut("slow", function() {
and then assign the associated HTML elements a class like
Your jQuery can now be $(".panelGroup1").fadeOut...
The . class selector for jQuery and the # is the id Selector.
Check out selectors and you can do a bunch of other crazy things
http://api.jquery.com/?ns0=1&s=Selector&go=