             # TODO: Handle errors better (call destroy?)
             console.error "Error getting page #{ pageNumber }", args...
 
-      $(window).on 'scroll.publication', @checkRender
-      $(window).on 'resize.publication', @checkRender
+      $(window).on 'scroll.publication resize.publication', @checkRender
 
     , (args...) =>
       # TODO: Handle errors better (call destroy?)

    pages = @_pages or []
    @_pages = null # To remove references to pdf.js elements to allow cleanup, and as soon as possible as this disables other callbacks

    $(window).off 'scroll.publication'
    $(window).off 'resize.publication'

    for page in pages
      page.page.destroy()

    $(@find '.viewport').height "#{ viewportHeightPercentage() }%"

Template.publicationScroller.destroyed = ->
  $(window).off '.publicationScroller'

Template.publicationScroller.sections = ->
  if Session.equals 'currentPublicationDOMReady', true
