Skip to content

Commit

Permalink
🐞 fix destroy with button; Fixes #719
Browse files Browse the repository at this point in the history
  • Loading branch information
desandro committed Sep 14, 2017
1 parent 16f3a2b commit 7f4b679
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion js/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ InfiniteScrollButton.prototype.hide = function() {
};

InfiniteScrollButton.prototype.destroy = function() {
this.element.removeEventListener( this.clickHandler );
this.element.removeEventListener( 'click', this.clickHandler );
};

// -------------------------- -------------------------- //
Expand Down
9 changes: 2 additions & 7 deletions sandbox/button-load.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,17 @@ <h1 class="post-header__title">Mealio logo</h1>
<script src="../js/scroll-watch.js"></script>
<script src="../js/page-load.js"></script>
<script src="../js/history.js"></script>
<script src="../js/button.js"></script>
<script>
var container = document.querySelector('.posts-container');
var infScroll = new InfiniteScroll( container, {
path: '.pagination__next',
append: '.post',
historyTitle: true,
button: '.load-more-button',
loadOnScroll: false,
history: false,
});

var loadMoreButton = document.querySelector('.load-more-button');

loadMoreButton.onclick = function() {
infScroll.loadNextPage();
};

</script>

</body>
Expand Down

0 comments on commit 7f4b679

Please sign in to comment.