2012-07-28 66 views
0

我想用jquery.cookie保存手風琴菜單的狀態(打開/關閉)。 有人可以幫我設置cookie嗎?jquery accordion cookie/persistence

$('#menu').children('[data-header]').hide().each(function() { 
    $(this).before('<h3 class="menu-header">' + $(this).data('header') + '</h3>'); 
}).prev().on("click", function() { 
    $(this).toggleClass('on').next().slideToggle(); 
    }); 
+0

你想這個數據來堅持在不同的頁面加載?如果是這樣,請使用像PHP這樣的服務器端語言。如果您只希望數據持續保存在頁面中,請使用全局範圍的變量 – hohner 2012-07-28 23:17:41

+0

請在http://jsfiddle.net上製作feedle並在此處發佈鏈接 – Kir 2012-07-29 11:02:03

回答