1

I'm trying to stop pace.js to load when the user clicks on Smoothstate links.

I thought calling Pace.stop inside smoothscroll on events, using the ignore setting but still the event is triggered.

 $('.chronology-nav a').click ->
    Pace.stop

onStart:
      duration: 2000
      render: ($container) ->
        $container.addClass 'is-exiting'
        $('body').removeClass('done')
        Pace.stop

OK. So I've found a solution its a bit hacky but for anyone struggling with this. I've added a class to body on the onStart method for smoothstate and in css made the pace progress div to display:none

Coffeescript code fragment

onStart:
      duration: 2000
      render: ($container) ->
        # add the tag that hides pace
        $('body').addClass('chronologyStart')
        $container.addClass 'is-exiting'
        Pace.stop
    onProgress:
      duration: 0
      render: ($container) ->
        Pace.stop
        $container.hide()
        return
    onReady:
      duration: 0
      render: ($container, $newContent) ->
        Pace.stop
        $container.show()
        smoothState.restartCSSAnimations()
        $('body').removeClass('chronologyStart')
        $container.html $newContent
        $container.removeClass 'is-exiting'
        return
adam
  • 618
  • 2
  • 11
  • 31

0 Answers0