I installed a vmware image from http://www.trendsigma.net/vmware/lubuntu1204t.html to test a few of jQuery things for my website. A strange behavior found in FireFox 11.0 and newest 15.01 when test in this virtual box is that the first "mousemove" event co-ordination is always have 1*1 pixel offset from the orginal mousedown event, thus it cause a lot of "draggable" element not working correctly. i.e , each time I "click" an element without move mouse, the element will move down-right an 1*1 offset.
here is some of my test code.
Code: Select all
$("#DragTest0").on("mousedown", function(e) {
$("#log").append("<br>mousedown button=" + e.button + " e.pageX=" + e.pageX + " e.pageY=" + e.pageY);
e.preventDefault();
e.stopPropagation();
if (e.button == 0 || e.button == 1) {
$(document).on('mousemove', function(e) {
$("#log").append("<br>document mousemove: e.pageX=" + e.pageX);
}).on('mouseup', function() {
$("#log").append("<br>document mouseup");
$(document).off('mousemove').off('mouseup');
});
}
});
result:
mousedown button=0 e.pageX=553 e.pageY=216
document mousemove: e.pageX=554 (each time you click without moving cursor, e.pageX and e.pageY adds 1)
document mouseup
...
Though I think this is much possible a bug in ubuntu Linux than firefox itself, i post it here to verify my doubt.
thanks in advance for any answer or suggesion.~~