Deprecated: Function create_function() is deprecated in /www/wwwroot/blog.fenewbee.com/usr/plugins/AntiSpam/Plugin.php on line 75
离开页面存setStorageCookie,再回到页面取setStorageCookie实现定位到tab - A Maverick Pig - - Life is more than just the present, but also poetry and the distance.

A Maverick Pig -

生活不止眼前的苟且
还有诗和远方

离开页面存setStorageCookie,再回到页面取setStorageCookie实现定位到tab

//检测页面是否即将离开
$(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);
	}

轻松解决,记一下

本原创文章未经允许不得转载 | 当前页面:A Maverick Pig - » 离开页面存setStorageCookie,再回到页面取setStorageCookie实现定位到tab

评论 1

  1. ooo哦哦哦

    匿名 2017-02-07    回复