Hi all,
I am using the drag function below which is from http://dunnbypaul.net/js_mouse/
I don't quite understand the code but was wondering if anyone knows how you would alter this code to so that objects being moved move a specified amount of pixels each time. Really the same functionality as snap in the scriptalicious drag drop function.
heres the drag function snippet.
I am using the drag function below which is from http://dunnbypaul.net/js_mouse/
I don't quite understand the code but was wondering if anyone knows how you would alter this code to so that objects being moved move a specified amount of pixels each time. Really the same functionality as snap in the scriptalicious drag drop function.
heres the drag function snippet.
Code:
function drag(e) // parameter passing is important for NS family
{
if (dragobj)
{
elex = orix + (mousex-grabx);
eley = oriy + (mousey-graby);
dragobj.style.position = "absolute";
dragobj.style.left = (elex).toString(10) + 'px';
dragobj.style.top = (eley).toString(10) + 'px';
}
update(e);
return false; // in IE this prevents cascading of events, thus text selection is disabled
}
Comment