Skip to content

Commit 63941ec

Browse files
committed
Unbind scroll event when reinstantiated
Scroll trigger would only take effect on first load: navigating back to the same page would fail to auto-load the next page on scroll. Solution from: magoosh#24
1 parent 6a63eac commit 63941ec

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

app/assets/javascripts/jquery.infinite-pages.js.coffee

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ Released under the MIT License
147147
# Have we waited enough time since the last check?
148148
shouldCheck = -> +new Date > lastCheckAt + scrollDelay
149149

150+
console.log "Unbinding..."
151+
@$context.unbind('scroll')
150152
@$context.scroll ->
151153
scrollHandler() if shouldCheck() # Call check once every scrollDelay ms
152154
if scrollTimeout

0 commit comments

Comments
 (0)