您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

基于jquery的jqDnR拖拽溢出的修改_jquery

2025/12/31 20:41:42发布19次查看
复制代码 代码如下:
/*
* jqdnr - minimalistic drag'n'resize for jquery.
*
* copyright (c) 2007 brice burgess , http://www.iceburg.net/
* licensed under the mit license:
* http://www.opensource.org/licenses/mit-license.php
*
* $version: 2007.08.19 +r2
* last modified by leegle 2011.02.11
* fix bug:溢出之后不能回来的,添加在范围内移动
*/
(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') {
//修改的位置 李飞二〇一一年二月十一日 14:35:19
e.css({ left: (m.x + v.pagex - m.px)}
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') {
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);
return false;
});
});
},
f = function(k) { return parseint(e.css(k)) || false; };
})(jquery);
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product