0
我想强调,因为用户的最后访问新的职位,只是因为它是在这里解释:时设置上次访问饼干
How to highlight new items on the site since last visit with jquery?
我使用jQuery来筛选我要强调的链接 - 它工作得很好
$(".itemlink").filter(function() {
return $(this).attr("data-timestamp") > $.cookie("last_visit");
}).addClass('highlight');
但我不知道什么时候设置“上次访问”cookie的正确时间。
到目前为止,我想这:
$(window).unload(function(){
$.cookie("last_visit", $.now());
});
它完全是我预料它会 - 遗憾的是,如果该页面被刷新,当然,这是一个“卸载”事件为好......所以,当我刷新页面,因为“上次访问”cookie会读取$ .now()
任何好的想法都可以让您更好地设置“上次访问”cookie ?
谢谢,这正是我需要的! –