This is my code:
HTML
<div id="canvas">
<div id="dragme"></div>
</div>
CSS
#canvas {
width:500px;
height:250px;
border:1px solid #444;
zoom:0.7;
}
#dragme {
width:100px;
height:50px;
background:#f30;
}
JS
$(function(){
$('#dragme').draggable({containment:'parent'})
})
I have a major issue when using css zoom
property. Position of target draggable div is not coordinated with cursor position.
Is there any clean and simple solution? I should be able to change zoom dynamically.
I used both tuze's and Yusuf Demirag's solutions and added a little something for dragging on a grid:
It has a minor bug (it can't sometimes get to an exact value eg: 160px) but it worked for what I needed.
Hope it helps.
The solution above did not work out for me. So I found my own. I wanted to share it if someone else also has the same issue.
You don't need to set zoom property. I just added the difference to draggable's position which occurs due to the zoom property. Hope it helps.
Fiddle
http://jsfiddle.net/TqUeS/
JS