//检测页面是否即将离开 $(window).bind('beforeunload',function(){ var tagValue = $(".nav-cont ul li.on").attr("id"); setStorageCookie("tag",tagValue);存session });
获取session,判断tab定位
//取cookie,判断tab var tagValue = getStorageCookie("tag"); if (tagValue == "pinglun"){ changecTabbar(2); }else if (tagValue == "zhaopianqian"){ changecTabbar(3); }else{ changecTabbar(1); }
轻松解决,记一下