Jump to content
GreenSock

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

Where are snap values calculated from? Top left corner?

Recommended Posts

Just a question I was thinking about... I didn't see it in the docs. When creating an snap function... the endValue... where is that being calculated from? The top left (0,0) point of the draggable element?

Share this post


Link to post
Share on other sites

It really depends on what the "type" is. Typically it's "x,y" which refer to the translateX/translateY transforms, and those are relative to the element's original position in the document flow (before any transforms are applied). You could think of it as if it's from the top left corner of the element in that case I guess. But if the type is "left,top", it'd refer to those values which are dependent on other factors like whether the element is position:relative or absolute (and would be affected by the offsetParent). 

  • Like 4

Share this post


Link to post
Share on other sites

Hi @danboyle8637 and Welcome to the GreenSock Forum!

 

Also don't forget if the type is left, top that the draggable elements parent also plays a role, depending if the parent has position relative or absolute.

 

:)

  • Like 3

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×