基于jquery的jqDnR拖拽溢出的修改
jQuery 基于 修改 溢出 拖拽
2023-06-13 09:14:26 时间
/*
*jqDnR-MinimalisticDrag"n"ResizeforjQuery.
*
*Copyright(c)2007BriceBurgess<bhb@iceburg.net>,http://www.iceburg.net/
*LicensedundertheMITLicense:
*http://www.opensource.org/licenses/mit-license.php
*
*$Version:2007.08.19+r2
*lastmodifiedbyleegle2011.02.11
*fixbug:溢出之后不能回来的,添加在范围内移动
*/
(function($){
$.fn.jqDrag=function(h){returni(this,h,"d");};
$.fn.jqResize=function(h){returni(this,h,"r");};
$.jqDnR={dnr:{},e:0,
drag:function(v){
if(M.k=="d"){
//修改的位置李飞二?一一年二月十一日14:35:19
E.css({left:(M.X+v.pageX-M.pX)<0?0:(M.X+v.pageX-M.pX)<document.documentElement.clientWidth-M.W?(M.X+v.pageX-M.pX):document.documentElement.clientWidth-M.W,top:(M.Y+v.pageY-M.pY)<0?0:(M.Y+v.pageY-M.pY)<document.documentElement.clientHeight-M.H?(M.Y+v.pageY-M.pY):document.documentElement.clientHeight-M.H});
}
else{E.css({width:Math.max(v.pageX-M.pX+M.W,0),height:Math.max(v.pageY-M.pY+M.H,0)});returnfalse;}
},
stop:function(){E.css("opacity",M.o);$(document).unbind("mousemove",J.drag).unbind("mouseup",J.stop);}
};
varJ=$.jqDnR,M=J.dnr,E=J.e,
i=function(e,h,k){
returne.each(function(){
h=(h)?$(h,e):e;
h.bind("mousedown",{e:e,k:k},function(v){
vard=v.data,p={};E=d.e;
//attemptutilizationofdimensionsplugintofixIEissues
if(E.css("position")!="relative"){
p=E.position();
if(!($.browser.msie&&($.browser.version=="6.0"))&&(E.css("position")=="fixed")){
p.top-=$(window).scrollTop();p.left-=$(window).scrollLeft()
}
}
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);
returnfalse;
});
});
},
f=function(k){returnparseInt(E.css(k))||false;};
})(jQuery);
相关文章
- jquery实现全选,取消,反选的功能&实现左侧菜单详解编程语言
- 基于jquery的超简单上下翻
- 基于jQuery的网页右下角弹出广告(IE7,firefox)
- 基于JQuery的访问WebService的代码(可访问Java[Xfire])
- 基于jquery的表头固定的若干方法
- 基于jquery的button默认enter事件(回车事件)。
- 非常棒的10款jQuery幻灯片插件
- 基于JQUERY的多级联动代码
- 精心挑选的15个jQuery下拉菜单制作教程
- js或者jquery判断图片是否加载完成实现代码
- 基于JQuery的列表拖动排序实现代码
- 多个jquery.datatable共存,checkbox全选异常的快速解决方法
- jQuery中.live()方法的用法深入解析
- 基于jQuery实现下拉框
- 使用jquery动态加载js文件的方法
- 分享2个jQuery插件--jquery.fileupload与artdialog
- jquery隔行换色效果实现方法