netease-youdao / hex

heX
Other
1.52k stars 300 forks source link

如何用鼠标移动页面的DIV来移动整个window窗口 #29

Open keith990 opened 10 years ago

keith990 commented 10 years ago

oDiv是页面上的一块区域,我想通过用鼠标移动oDiv来移动整个window窗口,但是下面的代码一直有问题,请问如何实现 oDiv.onmousedown = function(ev){ var ev = ev || event; document.onmousemove = function(ev){
hex.moveTo( ev.clientX, ev.clientY); // hex.move(); } document.onmouseup = function(){ document.onmousemove = null; document.onmouseup = null;
} }

luyuan commented 10 years ago

可以参考一下 hex-samples 项目中的范例:https://github.com/netease-youdao/hex-samples/tree/master/captionless-window-and-non-client-area-dragging