Skip to content
Advertisement

Can’t update my mouse position, because of my horizontal scroll (LocomotiveScroll)

I’m trying to make a custom cursor with the Ink Cursor by Ricardo Mendieta. https://codepen.io/mendieta/pen/WgvENJ

The cursor is working, but the problem I have is that I use a horizontal scroll with Locomotive Scroll. When I scroll, the mouse position doesn’t get updated. I tried to fix this with a mousewheel function. I can console log the mousewheel event, but it doesn’t update my mouse position.

JavaScript

Is there a way I can update the mouse position when I scroll when the scroll direction is horizontal.

Advertisement

Answer

I just figured this out for my situation, which I think is similar to yours. Not sure if this will help or not – hopefully it does.

JavaScript

So instead of trying to reconfigure where the mouse position is, I’m simply updating the “left” attribute of the custom cursor to be in sync with how much the horizontally laid out Locomotive scroll container is being scrolled.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement