Streaming live at 10am (PST)

Javacript - Calling Specific Webflow Animations

#1

Hi there,

I’m running into a bit of an issue figuring out how to temporarily deactivate a specific Webflow’s interaction from listening to the wheel event.

To cut a long story short, I think need to know how to retrieve an interaction’s function’s name. This is the code I have:

function disable_scroll() {
  document.removeEventListener('wheel', function_name);
  document.removeEventListener('mousewheel', function_name);
  document.removeEventListener('DOMMouseScroll', function_name);
}

function enable_scroll() {
  document.addEventListener('wheel', function_name);
  document.addEventListener('mousewheel', function_name);
  document.addEventListener('DOMMouseScroll', function_name);
}

(I know the wheel event listener is all I would need to remove, but I might as well remove everything related to scrolling, even deprecated events, just in case)

I’m not 100% sure I’m on the right track, but from what I understand I only have to pop the right function’s name in the place of function_name and Bob’s your uncle.

I already have a bit of embedded custom code that’s calling the disable_scroll() and enable_scroll function, and it’s working as intended. Here’s the one for disabling scrolling for anyone curious:

<a onclick="disable_scroll();" href="javascript:void(0);" 
style="position:absolute;width:100%;height:100%"></a>

So: how do I know which function(s) to refer to? Can it be done? I also welcome suggestions on other approaches to deactivate specific Webflow’s interactions through JS, or even on how to disable scrolling flat out: no overflow-hidden or getElementById tricks; wheel can’t fire at all or the interaction will activate and screw with my elements. It’s not ideal but I’d rather temporarily prevent the user from scrolling at all than have the interaction fire when I don’t want it to.

#2

For the record: if anyone knows how to call specific Webflow animations, I’m still interested! It’ll be much appreciated :smiley: