Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
dghez

Wrong fixed position onmodal based on the mouse position

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 post
Share on other sites

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

×