Jump to content
Search Community

Draggable question/suggestion

Esben Juul Mortensen test
Moderator Tag

Go to solution Solved by Sahil,

Recommended Posts

Is it possible to define points in css strings?

 

My usecase is a mobile menu that slides out after a drag.

The value that the draggable item ends at is a pixel value which is fine until you resize the browser. I know you can't resize a phone but a rotate will have the same issue and you can of course also have menus like that on desktops.

 

A points definition of…

["0%", "100%"]

 …would fix that.

See the Pen BabddVY by tfl (@tfl) on CodePen

Link to comment
Share on other sites

  • Solution

You can simply set position of nav on resize. Also, you don't need to recreate draggable on each resize, you could update snap value like in example below or use function to calculate snap position. (Check docs to see how to use function to calculate snap value.)

See the Pen eYXGPOa by Sahil89 (@Sahil89) on CodePen

  • Like 3
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...