Skip to content

Commit 7f4b679

Browse files
committed
🐞 fix destroy with button; Fixes #719
1 parent 16f3a2b commit 7f4b679

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

β€Žjs/button.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ InfiniteScrollButton.prototype.hide = function() {
7676
};
7777

7878
InfiniteScrollButton.prototype.destroy = function() {
79-
this.element.removeEventListener( this.clickHandler );
79+
this.element.removeEventListener( 'click', this.clickHandler );
8080
};
8181

8282
// -------------------------- -------------------------- //

β€Žsandbox/button-load.html

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,17 @@ <h1 class="post-header__title">Mealio logo</h1>
7777
<script src="../js/scroll-watch.js"></script>
7878
<script src="../js/page-load.js"></script>
7979
<script src="../js/history.js"></script>
80+
<script src="../js/button.js"></script>
8081
<script>
8182
var container = document.querySelector('.posts-container');
8283
var infScroll = new InfiniteScroll( container, {
8384
path: '.pagination__next',
8485
append: '.post',
85-
historyTitle: true,
86+
button: '.load-more-button',
8687
loadOnScroll: false,
8788
history: false,
8889
});
8990

90-
var loadMoreButton = document.querySelector('.load-more-button');
91-
92-
loadMoreButton.onclick = function() {
93-
infScroll.loadNextPage();
94-
};
95-
9691
</script>
9792

9893
</body>

0 commit comments

Comments
Β (0)