Authored by 郭成尧

save-by-href

... ... @@ -272,22 +272,19 @@ $(function() {
// tab
tabInit();
if (localStorage) {
if (document.referrer && document.referrer.indexOf('activity.yoho.cn') > -1) {
localStorage.removeItem('changtu1');
}
if (sessionStorage) {
// 微信中点击之后,返回跳到指定位置
let totalH, scH;
let top = localStorage.changtu1;
let key = `PAGE_SCROLL_TOP_${location.href}`;
let top = sessionStorage.getItem(key);
window.scrollTo(0, top);
localStorage.removeItem('changtu1');
sessionStorage.removeItem(key);
$('a').click(function() {
totalH = event.pageY;
scH = event.clientY;
localStorage.changtu1 = totalH - scH; // 每次点击缓存高度
sessionStorage.setItem(key, totalH - scH); // 每次点击缓存高度
});
}
... ...