mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Fix for scrolling to top in unsupported firefox
My previous fix didn't actually work. Instead of scrolling to the bottom it would scroll to the top, because it turns out document.body.scrollTop always returns 0 in Firefox. This should work in most browsers. See here: http://help.dottoro.com/ljnvjiow.php
This commit is contained in:
parent
019b021624
commit
c5b416b108
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user