diff --git a/src/clipboard-action.js b/src/clipboard-action.js index 8a0b3a4..f2bcba3 100644 --- a/src/clipboard-action.js +++ b/src/clipboard-action.js @@ -56,7 +56,7 @@ class ClipboardAction { this.fakeElem = document.createElement('textarea'); this.fakeElem.style.position = 'absolute'; this.fakeElem.style.left = '-9999px'; - this.fakeElem.style.top = document.body.scrollTop + 'px'; + this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px'; this.fakeElem.setAttribute('readonly', ''); this.fakeElem.value = this.text; this.selectedText = this.text;