Showing
1 changed file
with
5 additions
and
8 deletions
@@ -272,22 +272,19 @@ $(function() { | @@ -272,22 +272,19 @@ $(function() { | ||
272 | // tab | 272 | // tab |
273 | tabInit(); | 273 | tabInit(); |
274 | 274 | ||
275 | - if (localStorage) { | ||
276 | - if (document.referrer && document.referrer.indexOf('activity.yoho.cn') > -1) { | ||
277 | - localStorage.removeItem('changtu1'); | ||
278 | - } | ||
279 | - | 275 | + if (sessionStorage) { |
280 | // 微信中点击之后,返回跳到指定位置 | 276 | // 微信中点击之后,返回跳到指定位置 |
281 | let totalH, scH; | 277 | let totalH, scH; |
282 | - let top = localStorage.changtu1; | 278 | + let key = `PAGE_SCROLL_TOP_${location.href}`; |
279 | + let top = sessionStorage.getItem(key); | ||
283 | 280 | ||
284 | window.scrollTo(0, top); | 281 | window.scrollTo(0, top); |
285 | - localStorage.removeItem('changtu1'); | 282 | + sessionStorage.removeItem(key); |
286 | 283 | ||
287 | $('a').click(function() { | 284 | $('a').click(function() { |
288 | totalH = event.pageY; | 285 | totalH = event.pageY; |
289 | scH = event.clientY; | 286 | scH = event.clientY; |
290 | - localStorage.changtu1 = totalH - scH; // 每次点击缓存高度 | 287 | + sessionStorage.setItem(key, totalH - scH); // 每次点击缓存高度 |
291 | }); | 288 | }); |
292 | } | 289 | } |
293 | 290 |
-
Please register or login to post a comment