Could someone know how to through Jquery or Javascript call Webflow interaction? I discover when I change the viewport size from the physical mobile devices that the slider will not show image properly. I tried to use jquery load the page from the other page, the image show correct, but I have to click the button (trigger default interaction), then the slider can be able to start the slide show automatically.
Could some help and hit the same issue? Please let me know. Thanks!!
You will need to use your browser’s dev tools to locate the interaction you want in your site’s js file, usually at the bottom lines of the file. Looks something like this;
You can then call this interaction in a function (e.g. click) like this;
$(“.your-element-class”).click(function() {
var ix = Webflow.require(‘ix’);
var $target = $(‘.your-element-class’);
var trigger = {“type”:“click”,“stepsA”:[{“height”:“0px”,“transition”:“height 300ms ease 0”},{“wait”:“50ms”},{“display”:“none”}],“stepsB”:};
ix.run(trigger, $target);
return false;
});
@danro has written a very nice explanation on running webflow interactions via code below. Definitely very interesting once you get a working understanding (Interactions 2.0 stuff);
That’s good suggestion for calling the interaction in a function, but it has a bit different in my case. In my case, when I click on the button, the slide will show smoothly and correctly. Actually, I would that action run automatically as I click the button (Trigger the slide run, not trigger by hand manually). May I know your suggestion how to trigger (call function) automatically like I click on the button? Becase I tried to use jquery ready function (when page run), it seems not work. Do you have any other suggestion and advice. Thanks!!