Total beginner question - showing / hiding all bar one DIVs
Hi all. I'm a total noob to jQuery, just getting a feel of it at the moment.
Anyway, I have the following page:
http://www.edludlow.co.uk/jqueryDivs.htm
which will show / hide a series of DIVs.
The jQuery being used is:
-
$(document).ready(function() {
$("a#redAnchor").click(function () {
if ($("div#red").is(":hidden")) {
$("div#red").slideDown(2000);
} else {
$("div#red").slideUp(400);
}
});
$("a#blueAnchor").click(function () {
if ($("div#blue").is(":hidden")) {
$("div#blue").slideDown(2000);
} else {
$("div#blue").slideUp(400);
}
});
$("a#pinkAnchor").click(function () {
if ($("div#floating").is(":hidden")) {
$("div#floating").slideDown(2000);
} else {
$("div#floating").slideUp(400);
}
});
});
How would I modify to hide all visible DIVs when one is opened. So let's say I have red and blue open, and I click the pink link, I want to close red and blue and open pink.
Many thanks,
Ed Ludlow