1. 程式人生 > >$("#tabs") 保持上一次瀏覽的tab

$("#tabs") 保持上一次瀏覽的tab

save spa nbsp func getc ive log void new

 $(function () {
            $(".tabsli").click(function () { //keep last active tab, to avoid once user expand an email the page will reload, then "new email" tab will be acived
                var active = $("#tabs").tabs("option", "active");
                setCookie("task_email_active_tab", active);  //
save current active tab‘s index to cookie //alert(active); }); var lastActive = getCookie("task_email_active_tab"); //get current active tab‘s index from cookie if (lastActive=="" || lastActive==null) { lastActive = 0; }
//alert(lastActive); $("#tabs").tabs({ active: lastActive }); });

$("#tabs") 保持上一次瀏覽的tab