Copy Code code as follows:
/*
* jqdnr-minimalistic Drag ' n ' Resize for jQuery.
*
* Copyright (c) 2007 Brice Burgess <bhb@iceburg.net> 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: Can't come back after overflow, add in range move
*/
(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 ') {
Modified location Plum February 11, 2011 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):d OCUMENT.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)});
},
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);