Merge branch 'hotfix/commentscache' into 'release/6.6'
Hotfix/commentscache See merge request !1378
Showing
1 changed file
with
5 additions
and
4 deletions
@@ -272,18 +272,19 @@ $(function() { | @@ -272,18 +272,19 @@ $(function() { | ||
272 | // tab | 272 | // tab |
273 | tabInit(); | 273 | tabInit(); |
274 | 274 | ||
275 | - if (localStorage) { | 275 | + if (sessionStorage) { |
276 | // 微信中点击之后,返回跳到指定位置 | 276 | // 微信中点击之后,返回跳到指定位置 |
277 | let totalH, scH; | 277 | let totalH, scH; |
278 | - let top = localStorage.changtu1; | 278 | + let key = `PAGE_SCROLL_TOP_${location.href}`; |
279 | + let top = sessionStorage.getItem(key); | ||
279 | 280 | ||
280 | window.scrollTo(0, top); | 281 | window.scrollTo(0, top); |
281 | - localStorage.removeItem('changtu1'); | 282 | + sessionStorage.removeItem(key); |
282 | 283 | ||
283 | $('a').click(function() { | 284 | $('a').click(function() { |
284 | totalH = event.pageY; | 285 | totalH = event.pageY; |
285 | scH = event.clientY; | 286 | scH = event.clientY; |
286 | - localStorage.changtu1 = totalH - scH; // 每次点击缓存高度 | 287 | + sessionStorage.setItem(key, totalH - scH); // 每次点击缓存高度 |
287 | }); | 288 | }); |
288 | } | 289 | } |
289 | 290 |
-
Please register or login to post a comment