Jump to content

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

Draggable top/left in pixel and percentage

Recommended Posts

Hi everybody!


Just wondering, I am doing a web app it allows user can move the position of an element in Top/Left, they can change the type of position in Pixel or Percentage manually. But as I known Draggable only works on Pixel.


To do it I tried converting Percentage to Pixel and using Update method when user hover the element. But it is a cheat and sometimes the position of the element is vibrated.


Any advice?


Wish all you the best!

See the Pen rmVQWJ by duytan (@duytan) on CodePen

Link to comment
Share on other sites

Diaco has a couple demos in his collection that may also give you some ideas and help.


See the Pen ZYpXYP by MAW (@MAW) on CodePen

See the Pen OPWLOx by MAW (@MAW) on CodePen


Happy tweening.


  • Like 3
Link to comment
Share on other sites

Here's a more advanced demo. It works pretty much the same way as the one Jack did, except it uses x and y for better performance.

See the Pen WRQjJx?editors=0010 by osublake (@osublake) on CodePen



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