April 16, 2012
jquery div slider when postback div close
Question by saadan
I have a jquery slider that open and close my div. but when the page get a postback the div is closed.
and i want the div to stay open.
my slider
if ($(".div").is(":hidden")) {
$(".div").slideDown(1000); // slide it down
} else {
$(".div").slideUp(1000); // hide it
}
I thought about change the address, such as
website.com#open
and then check the adress
but how can i do this ?
Answer by Starx
When the page postbacks, the markup reverts to the original state. So, $(".div").is(":hidden")
will always return true.
You can create some sort of state identifier and use that to check the state.