zoukankan      html  css  js  c++  java
  • 解决:使用jquery1.4.2后 jqDrag 拖动 不可用

    jqDnR.js 原代码如下:

    (function($){
    $.fn.jqDrag=function(h){return i(this,h,'d');};
    $.fn.jqResize=function(h){return i(this,h,'r');};
    $.jqDnR={dnr:{},e:0,
    drag:function(v){
    if(M.k == 'd')E.css({left:M.X+v.pageX-M.pX,top:M.Y+v.pageY-M.pY});
    else E.css({Math.max(v.pageX-M.pX+M.W,0),height:Math.max(v.pageY-M.pY+M.H,0)});
    return false;},
    stop:function(){E.css('opacity',M.o);$().unbind('mousemove',J.drag).unbind('mouseup',J.stop);}
    };
    var J=$.jqDnR,M=J.dnr,E=J.e,
    i=function(e,h,k){return e.each(function(){h=(h)?$(h,e):e;
    h.bind('mousedown',{e:e,k:k},function(v){var d=v.data,p={};E=d.e;
    // attempt utilization of dimensions plugin to fix IE issues
    if(E.css('position') != 'relative'){try{E.position(p);}catch(e){}}
    M={X:p.left||f('left')||0,Y:p.top||f('top')||0,W:f('width')||E[0].scrollWidth||0,H:f('height')||E[0].scrollHeight||0,pX:v.pageX,pY:v.pageY,k:d.k,o:E.css('opacity')};
    E.css({opacity:0.8});$().mousemove($.jqDnR.drag).mouseup($.jqDnR.stop);
    return false;
    });
    });},
    f=function(k){return parseInt(E.css(k))||false;};
    })(jQuery);

    修改后
    代码如下:

    (function($){
    $.fn.jqDrag=function(h){return i(this,h,'d');};
    $.fn.jqResize=function(h){return i(this,h,'r');};
    $.jqDnR={dnr:{},e:0,
    drag:function(v){
    if(M.k == 'd')E.css({left:M.X+v.pageX-M.pX,top:M.Y+v.pageY-M.pY});
    else E.css({Math.max(v.pageX-M.pX+M.W,0),height:Math.max(v.pageY-M.pY+M.H,0)});
    return false;},
    stop:function(){E.css('opacity',M.o);$(document).unbind('mousemove',J.drag).unbind('mouseup',J.stop);}
    };
    var J=$.jqDnR,M=J.dnr,E=J.e,
    i=function(e,h,k){return e.each(function(){h=(h)?$(h,e):e;
    h.bind('mousedown',{e:e,k:k},function(v){var d=v.data,p={};E=d.e;
    // attempt utilization of dimensions plugin to fix IE issues
    if(E.css('position') != 'relative'){try{E.position(p);}catch(e){}}
    M={X:p.left||f('left')||0,Y:p.top||f('top')||0,W:f('width')||E[0].scrollWidth||0,H:f('height')||E[0].scrollHeight||0,pX:v.pageX,pY:v.pageY,k:d.k,o:E.css('opacity')};
    E.css({opacity:0.8});$(document).mousemove($.jqDnR.drag).mouseup($.jqDnR.stop);
    return false;
    });
    });},
    f=function(k){return parseInt(E.css(k))||false;};
    })(jQuery);


    即可

    原文:http://program.zz5u.net/js/2010/0514/10266.html

  • 相关阅读:
    设计模式:观察者模式
    设计模式:享元模式
    面试题:redis主从数据库不一致如何解决?
    面试题:Object obj = new Object()这句话在内存里占用了多少字节
    面试题:AtomicInteger和LongAdder区别
    @PrePersist 注解
    树莓派 zero w 添加微雪墨水屏 显示天气
    数据仓库项目中的数据建模和ETL日志体系
    TO B业务的发展
    Kylin、Druid、ClickHouse核心技术对比
  • 原文地址:https://www.cnblogs.com/linyechengwei/p/1762152.html
Copyright © 2011-2022 走看看