Webflow sync, pageviews & more.
NEW

How can Webflow Interactions still be triggered and work after using third party integrations like barba.js v2?

TL;DR
  • Webflow Interactions break after barba.js transitions due to AJAX page loading.
  • Fix by placing 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.

1. Understand the Issue

  • Webflow Interactions are only initialized on native page loads.
  • Barba.js v2 swaps page content via AJAX, so Webflow doesn’t detect the change and won’t bind Interactions to newly loaded elements.

2. Reinitialize Webflow Interactions After Barba Page Load

To make Interactions work after a barba.js transition:

  • Use the Webflow’s IX2 trigger reset method: Webflow.destroy(); Webflow.ready(); Webflow.require('ix2').init();
  • Place this inside barba’s afterEnter or after hook to trigger after each new page load.

Example (inside barba.init):

afterEnter() {  Webflow.destroy();  Webflow.ready();  Webflow.require('ix2').init();}
  • This ensures Webflow's interaction engine re-binds to new elements after each page transition.

3. Load Webflow Scripts Correctly

  • Make sure the Webflow.js script is included in the layout that persists across page changes.
  • If you’re loading it manually, only load Webflow.js once to avoid conflicts.
  • Do not re-initialize Webflow.js itself—just reset and rebind the Interactions engine as shown above.

4. Respect Page-specific Scripts or Custom Code

  • If you use Page Settings > Custom Code, those scripts are not reloaded on barba transitions.
  • Move important scripts from that section into barba lifecycle hooks or include them in the persistent layout.

5. Use Webflow.push(function(){ ... }) Pattern Carefully

  • Webflow uses Webflow.push to queue functions that should be executed after DOMContentLoaded.
  • After reinitialization, you can re-call any functions you queued this way.

Summary

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.

Rate this answer

Other Webflow Questions