手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jquery1.4后 jqDrag 拖动 不可用
jquery1.4后 jqDrag 拖动 不可用
摘要:复制代码代码如下:(function($){$.fn.jqDrag=function(h){returni(this,h,'d');};$....

复制代码 代码如下:

(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({width: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({width: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);

即可

【jquery1.4后 jqDrag 拖动 不可用】相关文章:

jQuery插件jRumble实现网页元素抖动

jQuery处理图片加载失败的常用方法

jquery使用经验小结

jQuery实现不断闪烁文字的方法

jquery中map函数遍历数组用法实例

jquery任意位置浮动固定层插件用法实例

jquery.validate使用时遇到的问题

Jquery实现动态切换图片的方法

jQuery的基本概念与高级编程

javascript实现行拖动的方法

精品推荐
分类导航