浏览代码

Fix autoscroll on chrome 87 patch version

simov 4 年之前
父节点
当前提交
f9cb7d9f25
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      content/index.js

+ 3 - 3
content/index.js

@@ -169,7 +169,7 @@ var scroll = (() => {
     .then(done)
   }
   function debounce (container, done) {
-    var listener = /body/i.test(container.nodeName) ? window : container
+    var listener = /html/i.test(container.nodeName) ? window : container
     var timeout = null
     listener.addEventListener('scroll', () => {
       clearTimeout(timeout)
@@ -200,10 +200,10 @@ var scroll = (() => {
         if (!loaded) {
           loaded = true
           if (state.content.scroll) {
-            listen($('body'), 'md-')
+            listen($('html'), 'md-')
           }
           else if (location.hash && $(location.hash)) {
-            $('body').scrollTop = $(location.hash).offsetTop
+            $('html').scrollTop = $(location.hash).offsetTop
           }
         }
       })