JqDrag drag after jquery1.4 is unavailable _ jquery

Source: Internet
Author: User
After jquery is upgraded to 1.4, jqDrag cannot be dragged. The Code is as follows:


(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'hange.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(effectinge.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 );


After modification

The Code is as follows:


(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'hange.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(effectinge.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 );


You can.

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.