OSDN Git Service

Unbind all document.on click/scroll after page fetch
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Fri, 21 Jun 2013 19:34:38 +0000 (22:34 +0300)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Fri, 21 Jun 2013 19:34:38 +0000 (22:34 +0300)
app/assets/javascripts/main.js.coffee

index fd7e296..59dfab8 100644 (file)
@@ -50,11 +50,13 @@ window.startSpinner = ->
 window.stopSpinner = ->
   $('.turbolink-spinner').fadeOut()
 
-window.stopEndlessScroll = ->
+window.unbindEvents = ->
   $(document).unbind('scroll')
+  $(document).off('scroll')
+  $(document).off('click')
 
 document.addEventListener("page:fetch", startSpinner)
-document.addEventListener("page:fetch", stopEndlessScroll)
+document.addEventListener("page:fetch", unbindEvents)
 document.addEventListener("page:receive", stopSpinner)
 
 $ ->