Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make css3 scaled elements draggable

I've noticed that the CSS3 scale attribute does really bad things to jquery ui, specifically to sortable. The problem is that the mouse still needs to move as much as if the elements were not scaled. Check out this jsfiddle example.

Does anybody have thoughts on how to fix this? Is it possible to change the speed that the mouse moves? I'm going to look into the html5 native drag and drop next, and try to write my own sortable function.

UPDATE:

Jquery ui draggable works ok with CSS3 scaled elements, here is a fiddle for it.

like image 266
lashleigh Avatar asked Feb 26 '23 02:02

lashleigh


1 Answers

It turns out the real answer does not require writing special move functions. Jquery ui sortable can be used as long as the items being sorted have been wrapped in a div of the appropriate size with overflow hidden. Check this jsfiddle for an example.

The problem was that I had forced the scaled divs to be close to one another using a negative margin. Then when I started to drag an item it was taking up the wrong amount of space. With the scaled item wrapped in a non-scaled div everything works as expected.

like image 148
lashleigh Avatar answered Mar 06 '23 21:03

lashleigh