Jump to content
Search Community

position does not match the cursor position when the page is scrolled

Ivan Mocs test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

  • Solution

That's because you're using event.x/y instead of event.pageX/pageY. 

 

Also, I'm not sure why you're animating EVERY image on every mousemove event.  Wouldn't it be more efficient to just animate the container? I'd recommend using gsap.quickTo() for the mousemove stuff too in order to maximize performance rather than creating a whole new tween on every event:

 

See the Pen ExpmLXB by GreenSock (@GreenSock) on CodePen

 

Better? 

  • Like 1
  • Thanks 1
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...