1
0
mirror of https://github.com/til-schneider/slim-wiki.git synced 2025-08-13 03:54:06 +02:00

Fixed: Scroll sync didn't work in Firefox

This commit is contained in:
til-schneider
2016-02-02 18:18:06 +01:00
parent 82209d2b20
commit 8920988642

View File

@@ -124,9 +124,14 @@
// Synchronize scroll position of preview when editor is scrolled
var scrollInfo = editor.getScrollInfo(),
scrollFactor = scrollInfo.top / (scrollInfo.height - scrollInfo.clientHeight),
bodyElem = document.body;
docElem = document.documentElement,
bodyElem = document.body,
scrollHeight;
window.scrollTo(0, scrollFactor * (bodyElem.scrollHeight - bodyElem.clientHeight));
// Workaround: In Chrome the body has the real scrollHeight, in Firefox the documentElement has it
scrollHeight = Math.max(docElem.scrollHeight, bodyElem.scrollHeight);
window.scrollTo(0, scrollFactor * (scrollHeight - bodyElem.clientHeight));
}
function callRpc(objectName, methodName, paramArray, done) {