Home >Web Front-end >HTML Tutorial >About accordion_html/css_WEB-ITnose in UI

About accordion_html/css_WEB-ITnose in UI

WBOY
WBOYOriginal
2016-06-24 12:25:221343browse

This post was last edited by wrost on 2013-11-20 15:58:02


After this accordion is refreshed, the main menu that was just opened still remains. How is this achieved?
demo
http://www.wangjie.org/css-menu/demo/112xiala/
Source code:
http://www.wangjie.org/css-menu/detail-6511.aspx


Once the accordion of jquery ui is refreshed, the main menu that is open cannot be kept
http://jqueryui.com/accordion/

Reply to the discussion (solved Solution)

Write a cookie

$(window).bind('unload', function(){ //clean up and persist on page unload
$('.' config ["headerclass"]).unbind()
var expandedindices=[]
$('.' config["contentclass"] ":visible").each(function(index){ //get indices of expanded headers
expandedindices.push($(this).attr('contentindex'))
})
if (config.persiststate==true && $('.' config["headerclass"]) .length>0){ //persist state?
expandedindices=(expandedindices.length==0)? '-1c' : expandedindices //No contents expanded, indicate that with dummy '-1c' value?
ddaccordion.setCookie(config.headerclass, expandedindices)
}
})

Very bad, it only records when unloading that the panel is closed

ddaccordion.setCookie(config. headerclass, expandedindices)

Write a cookie

$(window).bind('unload', function(){ //clean up and persist on page unload
$('. ' config["headerclass"]).unbind()
var expandedindices=[]
$('.' config["contentclass"] ":visible").each(function(index){ //get indices of expanded headers
expandedindices.push($(this).attr('contentindex'))
})
if (config.persiststate==true && $('.' config["headerclass" ]).length>0){ //persist state?
expandedindices=(expandedindices.length==0)? '-1c' : expandedindices //No contents expanded, indicate that with dummy '-1c' value?
ddaccordion.setCookie(config.headerclass, expandedindices)
}
})

Very bad. It only records when unloading that the panel is closed

ddaccordion.setCookie( config.headerclass, expandedindices)


Thank you, so it is achieved by setting and reading cookies? Right?

Yes, look at that code
ddaccordion.setCookie(config.headerclass, expandedindices)
This method is to write the cookie package
when loading the page There is also getCookie

Yes, look at that code
ddaccordion.setCookie(config.headerclass, expandedindices)
In this method, the cookie package is written
When the page is loaded, There is getCookie

Thank you very much! !

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn