Jquery draggable with zoom problem
Posted
by Manuel
on Stack Overflow
See other posts from Stack Overflow
or by Manuel
Published on 2010-05-28T15:01:04Z
Indexed on
2010/06/10
22:33 UTC
Read the original article
Hit count: 250
I am working on a page in witch all its contents are scaled by using zoom. The problem is that when I drag something in the page the dragging item gets a bad position that seems relative to the zoom amount.
To solve this I tried to do some math on the position of the draggable component, but seems that even tho visually its corrected, the "true" position its not recalculated.
here is some code to explain better:
var zoom = Math.round((parseFloat($("body").css("zoom")) / 100)*10)/10;
var x = $(this).data('draggable').position;
$(this).data('draggable').position.left = Math.round(x.left/zoom);
$(this).data('draggable').position.top = Math.round(x.top/zoom);
Any help would be greatly appreciated
© Stack Overflow or respective owner