From 8cc9e18990e0b4c6fef9464282d34be21bf30732 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Sat, 15 Aug 2020 20:25:33 -0400 Subject: [PATCH] Fix undefined $scrollParent --- js/src/forum/components/NotificationList.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/src/forum/components/NotificationList.js b/js/src/forum/components/NotificationList.js index 0c7a463b4..8b2c905d9 100644 --- a/js/src/forum/components/NotificationList.js +++ b/js/src/forum/components/NotificationList.js @@ -99,6 +99,7 @@ export default class NotificationList extends Component { const $notifications = this.$('.NotificationList-content'); const $scrollParent = $notifications.css('overflow') === 'auto' ? $notifications : $(window); + $scrollParent.on('scroll', this.scrollHandler.bind(this)); } @@ -111,12 +112,13 @@ export default class NotificationList extends Component { scrollHandler() { const state = this.attrs.state; - const scrollTop = $scrollParent.scrollTop(); - const viewportHeight = $scrollParent.height(); const $notifications = this.$('.NotificationList-content'); const $scrollParent = $notifications.css('overflow') === 'auto' ? $notifications : $(window); + const scrollTop = $scrollParent.scrollTop(); + const viewportHeight = $scrollParent.height(); + const contentTop = $scrollParent === $notifications ? 0 : $notifications.offset().top; const contentHeight = $notifications[0].scrollHeight;