$("#tabs") 保持上一次浏览的tab

 $(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 });

        });

 

posted @ 2018-02-14 08:58  emmaKang  阅读(173)  评论(0编辑  收藏  举报