I want to make Draggable div
i know this can be done using Jquery plug in but I don’t want to use because I just need only draggable function.
so how can I make draggable function
I have did this
$(document).ready(function(e){
$("#eve").mousemove(function(e){
var p=$(this);
var offset = p.offset();
var ol=offset.left;
var ot=offset.top;
var l=e.pageX-ol;
var t=e.pageY-ot;
var eX=e.pageX;
var eY=e.pageY;
var htm="left:"+ol+" top:"+ot+"<br/>";
htm+="eX:"+eX+" eY:"+eY+"<br/>";
htm+="curX:"+l+" curY:"+t+"<br/>";
htm+="l:"+(ol-l)+" t:"+(ot-t);
p.html(htm);
p.css({left:((eX-3))+"px",top:((eY-3))+"px"});
});
You need to define multiple function to handle the
mousedownevent to start drag,mouseupto stop draging, and appropriatemousemoveto handle the movements while dragging, check this gist i found https://gist.github.com/1330150