-
-
Save tiansial/390aa43a71530c550c169cc9104921a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Barba from 'barba.js/dist/barba'; | |
export default function (routes) { | |
Barba.Pjax.Dom.wrapperId = 'barba-wrapper'; | |
Barba.Pjax.Dom.containerClass = 'barba-container'; | |
// Fire Barba.js | |
Barba.Pjax.start(); | |
Barba.Prefetch.init(); | |
Barba.Dispatcher.on('transitionCompleted', function() { | |
// Set new classes from #af-classes to body | |
$('body').attr('class', $('main').attr('class')); | |
// Fire routes again after new content loaded | |
routes.loadEvents(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment