Jump to content
Search Community

Custom cursor with gsap with horizontal scroll

Akash Ranjan test
Moderator Tag

Go to solution Solved by akapowl,

Recommended Posts

Hey Guys,

 

I am trying to create a custom cursor with gsap. My site is horizontal scroll based as you can see in the codepen demo. The problem is whenever I am scrolling the cursor also moves up.

 

How can i stop this from happening and make it behave just like a normal cursor.

 

I am working in Next JS with the cursor being a separate component.

 

Please help me.

 

Thanks alot

See the Pen rNRZWxx by akashrwx (@akashrwx) on CodePen

Link to comment
Share on other sites

  • Solution


That's probably mostly a concern of your CSS styling and nothing GSAP related.

Your cursor is set to position: absolute  - that will be in relation to the body in your case.

The page keeps on scrolling vertically, even if you fake a horizontal scrolling movement.

Thus you cursor will also move up as it keeps scrolling with the body.

The easiest way would probably be to just set it to position: fixed isntead.
 

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...