Modification of JQDNR drag-and-drop overflow based on jquery _jquery

Source: Internet
Author: User
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);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.