此代码与 jQuery-1.3.2.min.js 一起运行良好,但不能与 jQuery-1.6.2.min.js 一起运行。
$(function(){
$(document).mousedown(mouseUpAfterDrag);
function mouseUpAfterDrag(e) {
/* You can record the starting position with */
var start_x = e.pageX;
var start_y = e.pageY;
$().mousemove(function(e) {
/* And you can get the distance moved by */
var offset_x = e.pageX - start_x;
var offset_y = e.pageY - start_y;
});
$().one('mouseup', function() {
alert("This will show after mousemove and mouse released.");
$().unbind();
$(document).mousedown(mouseUpAfterDrag);
});
// Using return false prevents browser's default,
// often unwanted mousemove actions (drag & drop)
return false;
}
});
如何让这段代码在 jQuery-1.6.2.min.js 上运行?任何解决方案?