1
0
mirror of https://github.com/flarum/core.git synced 2025-08-07 17:07:19 +02:00

Fix undefined $scrollParent

This commit is contained in:
Alexander Skvortsov
2020-08-15 20:25:33 -04:00
committed by Franz Liedke
parent 94d3bea53e
commit 8cc9e18990

View File

@@ -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;