I'm using jquery .show to open a div. I've got it working fine but I'm having a bit of trouble working out how to get it to check if the div's already open. If it is, I don't want it to repeat the .show function. What's the best way to do this?
What I'm using at the moment is (jquery + jquery ui)
$(document).ready(function() {
$('.content').hide();
$(".open").click(function () {
$(".content").show("slide", { direction: "up" },1200);
});
$(".close").click(function () {
$(".content").hide("slide", { direction: "up" },1200);
});
});
if ($(".content").is(":visible") {
// it is showing already
} ...
You might also look at http://api.jquery.com/slideToggle/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With