fix scrolling to comment

This commit is contained in:
igoradamenko
2018-05-26 23:02:37 +03:00
parent b5fd095954
commit faeb4d3d1d
+1 -7
View File
@@ -63,13 +63,7 @@ function init() {
}
if (data.scrollTo) {
const iframeTop = iframe.getBoundingClientRect().top;
// sometimes browser is already scrolled to the element (like Safari on macOS)
// so let's check it and prevent our scrolling if it so
if (data.scrollTo + iframeTop === 0) return;
window.scrollTo(window.pageXOffset, data.scrollTo + iframeTop);
window.scrollTo(window.pageXOffset, data.scrollTo + iframe.getBoundingClientRect().top + window.pageYOffset);
}
} catch (e) {}
}