Jump to content
Search Community

Wrong fixed position onmodal based on the mouse position

dghez test
Moderator Tag

Go to solution Solved by Carl,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi everyone,

I recreated a codepen that replicate more or less my problem (for using that click somewhere in the white area)
I'm trying to achieve something like the one you can see. I need to open a "fixed popup" that everytime change it's initial position.

If you try the pen everything works fine for the only first click but if  you try to click again you can see that the "modal" still opening from the position you clicked the first time. Can anyone explain whats is going on?

 

ps: I added a delay so you can see clearly what's is going on.

Thanks eveyone!

See the Pen LZxLzR by anon (@anon) on CodePen

Link to comment
Share on other sites

  • Solution

Thanks for the demo.

I think the problem is that you are creating a timeline once and replaying that same timeline over and over. Keep in mind that starting and ending values in every tween in a timeline are recorded and re-used on each play. In this case I think you want a fresh timeline each time. 

 

Sort of like: http://codepen.io/GreenSock/pen/rLjzoG?editors=1010

  • Like 1
Link to comment
Share on other sites

So essentially I should declare every click the timeline, otherwise it takes the original values of when I declared it. Am i right?
 

Thanks for the demo.

I think the problem is that you are creating a timeline once and replaying that same timeline over and over. Keep in mind that starting and ending values in every tween in a timeline are recorded and re-used on each play. In this case I think you want a fresh timeline each time. 

 

Sort of like: 

See the Pen rLjzoG?editors=1010 by GreenSock (@GreenSock) on CodePen

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...