Webflow.destroy(); Webflow.ready(); Webflow.require('ix2').init();
in barba’s afterEnter()
hook to reinitialize Interactions after each transition.When integrating barba.js v2 with Webflow, Interactions may stop working because Webflow binds them only on page load. Barba.js uses AJAX page transitions, so Interactions won’t automatically reinitialize after new content loads.
To make Interactions work after a barba.js transition:
Webflow.destroy(); Webflow.ready(); Webflow.require('ix2').init();
afterEnter
or after
hook to trigger after each new page load.Example (inside barba.init):
afterEnter() { Webflow.destroy(); Webflow.ready(); Webflow.require('ix2').init();}
Webflow.push(function(){ ... })
Pattern CarefullyWebflow.push
to queue functions that should be executed after DOMContentLoaded.To ensure Webflow Interactions work with barba.js v2, you must destroy and reinitialize Webflow’s IX2 engine after each content transition using Webflow.destroy(); Webflow.ready(); Webflow.require('ix2').init();
. Place this inside afterEnter()
in barba.js to trigger Interactions on new pages.