for ix1 there has been an option to reinitialize webflow which was absolutely needed to build single page websites and make webflow’s interactions work. the functions were Webflow.ready(); and Webflow.destroy();.
is anyone aware of something similar that works for ix2? because the functions above don’t.
Hi, Has anyone found a solution for this. I’ve been having a similar issue, this is what I’ve done so far:
I’ve setup buttons that load pages “page1” & “page2” using Barba.js. The pages are loading and transitions between pages are working but the content that is loading into the barba-container is not responsive. Click events & gsap animations that are in the html embed panel are not working.
Hope this explanation makes sense, I’ve also included a share link below. Thank you!
I integrate with firebase to load some larger datasets that CMS isn’t designed for… I lazy load so as to save on reads (obviously), and I need a way to reinitialize the interactions.
I have reverted to v1 interactions and destroy() / ready() after each dynamic load … which kinda sucks and also creates some frustrations with regard to state. (since click interactions aren’t toggles but rather “first click / second click”
We need a way to reinitialize v2 interactions. Better yet, would be nice to have a way to simply troll the DOM (or a particular dom element) and add the interaction listeners as needed.
Hi all, sorry for the delayed response on this topic. As you’ve discovered, IX2 doesn’t quite work the same as the rest of our code that supports the Webflow.ready/destroy cycle.
While Webflow.destroy() does in fact stop the IX2 engine and all associated events + state… the ready() function does not re-initialize the engine.
Webflow.require('ix2').init() should do the trick in most cases. As long as IX2 has been initialized once with the serialized JSON data, repeated calls to init() will simply restart the engine and query the DOM for any new nodes that may be affected.
@Reed_Debaets Re: partial state reloading, unfortunately we do not yet support this.
However, if you are familiar with Redux stores, you may be able to figure out how to re-populate the IX2 state, since we publicly expose the IX2 store + actions. Here’s an example:
const store = Webflow.require('ix2').store;
let oldState;
store.subscribe(() => {
const ixSession = store.getState().ixSession;
const eventState = ixSession.eventState;
if (oldState !== eventState) {
console.log(eventState);
oldState = eventState;
}
});
Using the above should output any IX2 event state changes such as hover or second click. Once you figure out which event’s state you’d like to modify, you can simply dispatch an action to the store. Here’s what a second click state restore might look like:
Hi @andy_burke, i’m trying to figure out the same thing. Is that code you posted something that should be added inside the barba.js transition function before the _this.done(); or somewhere else? @buntestrahlen did you had a chance to look at this solution?
I take it back, it’s working, but somehow not for an element that’s on a display: none div (which is later shown through code). Any hints on why that might be happening?