barba.js is a library that enables smooth transitions between your pages by actually faking reloads. when you click a link, it swaps the content of your current page container with the content of the next pages container and also updates the url. repeating elements like the navbar or footer don’t need to be reloaded. you see huge enhancement in page load times and can also animate the transition between pages without the white flash. you can find examples of the plugin here.
this is what i got so far. click on the images to go to the next page and back. i added an animation to the first link and no animation to the second link. just to see its working. the thing is… as the library is not really loading the next page and its scripts (including webflow interactions) you only get to see webflow interactions on the first page and not on the ongoing pages. thats why i want to reload the interactions from the .js file generated by webflow after every page transition.
when i copy the code (staring with Webflow.require('ix').init) it works beautifully. but i have to add this manually. so when i add or change an interaction within webflow i have to copy every code change to my custom code. i would like to do this automatically. so i thought about reloading the webflow.js file after every page transition. but i get an error message saying Uncaught TypeError: n is not a function.
is anyone aware of a method on how to reload that script correctly? do i have to clean up the old code at first?
hopefully someone reads this as its pretty complex.
thank you so much for your time!
Hello, and thank you for this. Speaking of structure, the barba-container is the container to reload, and the wrapper is where it will be displayed?
And what about this code that @callmechris suggested you?
$( document ).ajaxSend(function() {
Webflow.destroy()
});
hey manuele.
yes, thats right. only the container inside the wrapper will get loaded when you navigate through your site. navbars or footers for example should therefore be moved outside the wrapper.
the code @CallMeChris suggested is needed in order for the weblow interactions to work. but this only works with ix1 (legacy) not ix2. i did not find a solution for ix2 yet.
Does Barbajs work with Webflow, if I do the animation in “When Page Starts Loading” and "When Page Finishes Loading? I would love to build every website with page transition, but I dont want my navbars to refresh.