Commit be26d2724bc710bdc0cb2327830aff84ce61fba2

Authored by Dmitriy Zaporozhets
1 parent c3c84992

Unbind all document.on click/scroll after page fetch

Showing 1 changed file with 4 additions and 2 deletions   Show diff stats
app/assets/javascripts/main.js.coffee
@@ -50,11 +50,13 @@ window.startSpinner = -> @@ -50,11 +50,13 @@ window.startSpinner = ->
50 window.stopSpinner = -> 50 window.stopSpinner = ->
51 $('.turbolink-spinner').fadeOut() 51 $('.turbolink-spinner').fadeOut()
52 52
53 -window.stopEndlessScroll = -> 53 +window.unbindEvents = ->
54 $(document).unbind('scroll') 54 $(document).unbind('scroll')
  55 + $(document).off('scroll')
  56 + $(document).off('click')
55 57
56 document.addEventListener("page:fetch", startSpinner) 58 document.addEventListener("page:fetch", startSpinner)
57 -document.addEventListener("page:fetch", stopEndlessScroll) 59 +document.addEventListener("page:fetch", unbindEvents)
58 document.addEventListener("page:receive", stopSpinner) 60 document.addEventListener("page:receive", stopSpinner)
59 61
60 $ -> 62 $ ->