0
Hello.
I have a function to "create" a Accordion of jQuery UI in my div.
Turns out inside this mine div there are several controls that make post on the page. What I want is that by making a post on the page, my accordion keep the state, that is, if it is open, I want it to keep open, if it is closed, I want it to remain closed.
Follow the code that "creates" the Accordion
$(document).ready(function () {
accordion();
});
function accordion() {
$("#accordion").accordion({
heightStyle: "content",
collapsible: true,
active: false,
beforeActivate: function (event, ui) {
// faço algumas coisas aqui.
}
});
}
The problem of "creating" the accordion in the $(document).ready
is that he will be recreated every post page.
Addendum: I’m also using the Updatepanel from the Ajaxcontroltoolkit to maintain the states of my page controls.
How I do for my job accordion();
be called only once?
the line
document.cookie.indexOf("accordion=true;")
always returns -1, so it will always execute the functionaccordion()
. And this is exactly what I don’t want. I need this functionaccordion()
is executed only once.– Leonardo Ribeiro de Aguiar