i guys this is a pretty advanced coding question.
i am trying to add barba.js to my webflow site.
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!