;(function ($) {
var dragpanelid = "Divcontext";
var _idiffx = 0;
var _idiffy = 0;
var _div = null;
$.extend ({
Attachdrag:function (Dragid) {
if (Dragid)
$._div = document.getElementById (Dragid);
Else
$._div = document.getElementById ($. Dragpanelid);
Document.body.onmousedown = $._handlemousedown;
},
_handlemousedown:function () {
var oevent = window.event;
if ($._div) {
$._IDIFFX = Oevent.clientx-$._div.offsetleft;
$._idiffy = Oevent.clienty-$._div.offsettop;
Document.body.onmousemove = $._handlemousemove;
Document.body.onmouseup = $._handlemouseup;
}
},
_handlemousemove:function () {
var oevent = window.event;
$._div.style.left = Oevent.clientx-$._idiffx;
$._div.style.top = Oevent.clienty-$._idiffy;
$._div.style.cursor = "Move";
},
_handlemouseup:function () {
Document.body.onmousemove = null;
Document.body.onmouseup = null;
$._div.style.cursor = "Default";
}
});
}
) (JQuery)
jquery Implementation page Control drag effect JS code