关于 UI 中的 accordion_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:25:22
Original
1215 people have browsed it

本帖最后由 wrost 于 2013-11-20 15:58:02 编辑


这个accordion刷新后,仍然保持刚才打开的那个 主菜单,请问是怎么实现的
demo
http://www.wangjie.org/css-menu/demo/112xiala/
源码:
http://www.wangjie.org/css-menu/detail-6511.aspx


jquery ui 的 accordion 一刷新,就不能保持打开的那个 主菜单
http://jqueryui.com/accordion/

回复讨论(解决方案)

写个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)
}
})

很坏啊 在unload的时候才记录 那个面板被关闭

ddaccordion.setCookie(config.headerclass, expandedindices)

写个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)
}
})

很坏啊 在unload的时候才记录 那个面板被关闭

ddaccordion.setCookie(config.headerclass, expandedindices)


谢谢,这么说它是通过设置、读取cookie来实现的了? 对吗

是啊 你看那段代码
ddaccordion.setCookie(config.headerclass, expandedindices)
这个方法里面就是写cookie的封装
当加载页面的时候 还有个 getCookie

是啊 你看那段代码
ddaccordion.setCookie(config.headerclass, expandedindices)
这个方法里面就是写cookie的封装
当加载页面的时候 还有个 getCookie

非常感谢!!

Related labels:
source:php.cn
Statement of this Website
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 [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!