diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-10-01 11:49:17 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2017-10-01 11:49:17 +0200 |
commit | 9c46b347b8118a127ca965106f66bb4d4d43f427 (patch) | |
tree | 0e883caed0b43bbab60faa59d1340a0495857b8f /tpl/default | |
parent | a59bbf50d7530d7e82a91896a210b9da49cb1568 (diff) | |
download | Shaarli-9c46b347b8118a127ca965106f66bb4d4d43f427.tar.gz Shaarli-9c46b347b8118a127ca965106f66bb4d4d43f427.tar.zst Shaarli-9c46b347b8118a127ca965106f66bb4d4d43f427.zip |
Fix jumpy textarea with long content in post edit
We manually reset the scroll position, to avoid height = 'auto' jump to the top
Fixes #971
Diffstat (limited to 'tpl/default')
-rw-r--r-- | tpl/default/js/shaarli.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tpl/default/js/shaarli.js b/tpl/default/js/shaarli.js index 1c66ebbd..55656f80 100644 --- a/tpl/default/js/shaarli.js +++ b/tpl/default/js/shaarli.js | |||
@@ -275,8 +275,14 @@ window.onload = function () { | |||
275 | }; | 275 | }; |
276 | function init () { | 276 | function init () { |
277 | function resize () { | 277 | function resize () { |
278 | /* Fix jumpy resizing: https://stackoverflow.com/a/18262927/1484919 */ | ||
279 | var scrollTop = window.pageYOffset || | ||
280 | (document.documentElement || document.body.parentNode || document.body).scrollTop; | ||
281 | |||
278 | description.style.height = 'auto'; | 282 | description.style.height = 'auto'; |
279 | description.style.height = description.scrollHeight+10+'px'; | 283 | description.style.height = description.scrollHeight+10+'px'; |
284 | |||
285 | window.scrollTo(0, scrollTop); | ||
280 | } | 286 | } |
281 | /* 0-timeout to get the already changed text */ | 287 | /* 0-timeout to get the already changed text */ |
282 | function delayedResize () { | 288 | function delayedResize () { |