Jump to content
GreenSock

xling

Draggable+Inertia: Snapping with rem units

Go to solution Solved by GreenSock,

Recommended Posts

Hi!

Is it possible to use rem or em units to create snap points?

I'm trying to create a carousel that always snaps the nearest card to the center, but the cards uses rem units instead of px.
This carousel starts with a center card and can be dragged left/right.

Thank you for any clarifications!

See the Pen LYdwJKK by xling (@xling) on CodePen

Link to comment
Share on other sites

  • Solution

No, you can't use rem but you can just convert it to px: 

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

 

Does that help?

Link to comment
Share on other sites

Yes it helped, thanks!

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