Skip to content

A platform for community discussion. Free, open, simple.

FIX: Use scrollY for current scroll position

Penar Musaraj59a83634c4ba
diff --git a/app/assets/javascripts/discourse/app/lib/lock-on.js b/app/assets/javascripts/discourse/app/lib/lock-on.js
index c0af323392c..941e7d4a986 100644
--- a/app/assets/javascripts/discourse/app/lib/lock-on.js
+++ b/app/assets/javascripts/discourse/app/lib/lock-on.js
@@ -113,10 +113,7 @@ export default class LockOn {
return this.clearLock();
}
- if (
- !within(4, top, this.previousTop) ||
- !within(4, window.scrollTop, top)
- ) {
+ if (!within(4, top, this.previousTop) || !within(4, window.scrollY, top)) {
window.scrollTo(window.pageXOffset, top);
this.previousTop = top;
}