图片拖拽的继承,引用 3

//LimitDrag.js


LimitDrag.prototype.fnMove=function(ev){
    var oEvent=ev||event;
    var L= oEvent.clientX-this.disX
    var T= oEvent.clientY-this.disY
    if(L<0){
        L=0
    }
    else if(L>document.documentElement.clientWidth-this.oDiv.offsetWidth){
        L=document.documentElement.clientWidth-this.oDiv.offsetWidth
    }
    if(T<0){
        T=0
    }
    else if(T>document.documentElement.clientHeight-this.oDiv.offsetHeight){
        T=document.documentElement.clientHeight-this.oDiv.offsetHeight
    }
    this.oDiv.style.left=L+'px';
    this.oDiv.style.top=T+'px';
}
原文地址:https://www.cnblogs.com/mylove0/p/7465042.html