码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2018-02-14 10:33:58      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:fun   function   span   option   post   new   pre   expand   alert   

 $(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

标签:fun   function   span   option   post   new   pre   expand   alert   

原文地址:https://www.cnblogs.com/kangjing/p/8447884.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!