-2
window.addEventListener(mousewheelEvent, _.throttle(parallaxScroll, 60), false);

I have an event listener that listens to a mousewheelEvent to trigger a function, yet trying to trigger that function directly (on a different page, using react) will invariably only pass a mouseclick event. What's something I can listen to via DOM to trigger the function as a mousewheelEvent when someone onclicks a button?

Toothgip
  • 469
  • 6
  • 14
  • https://reactjs.org/docs/events.html#mouse-events, https://reactjs.org/docs/events.html#wheel-events What is a "mousewheelEvent"? It seems to be fairly deprecated. Have you tried simply `window.addEventListener("wheel", ......`? – Drew Reese Feb 02 '21 at 07:53
  • Yes, it is the old school version of wheel. I'm wondering if there's a way to perhaps to use an onclick to trigger a natural scroll to trigger the listener to the scroll or pass off a scroll through an onclick. – Fifth Dimension Dragon Feb 02 '21 at 07:58

1 Answers1

0

Sadly, the attitude of some in this community is outright toxic as indicative by the votes here and in this question...

Trigger 'dummy' mouse wheel event

The short of it, is that you cannot trigger a dummy mouse event. The second best option is to create a new function that closely matches what the scroll or wheel event triggers and utilize that on the onClick.