Fix scrolling

This commit is contained in:
Peter Stuifzand 2018-09-01 21:49:32 +02:00
parent d88f7ab1d9
commit 7845004840

View File

@ -59,11 +59,8 @@
.then(() => { .then(() => {
item._is_read = true item._is_read = true
}) })
}
}, },
handleScroll() {
mounted() {
window.onscroll = () => {
// let bottomOfWindow = document.documentElement.scrollTop + window.innerHeight === document.documentElement.offsetHeight; // let bottomOfWindow = document.documentElement.scrollTop + window.innerHeight === document.documentElement.offsetHeight;
let bottomOfWindow = document.documentElement.scrollTop + window.innerHeight === this.$el.offsetHeight + document.documentElement.offsetHeight + 20; let bottomOfWindow = document.documentElement.scrollTop + window.innerHeight === this.$el.offsetHeight + document.documentElement.offsetHeight + 20;
if (bottomOfWindow) { if (bottomOfWindow) {
@ -94,6 +91,14 @@
} }
}) })
} }
},
created() {
window.addEventListener('scroll', this.handleScroll);
},
destroyed() {
window.removeEventListener('scroll', this.handleScroll);
} }
} }
</script> </script>