I got a strange problem. I capture mouse movements with:
var mmoves = []; jQuery(document).mousemove(function(event) { mmoves.push({x:event.pageX, y:event.pageY}) }
Then I attach the div to the page, for example:
$("body").append('<div id="mouseemul" style="padding:0; margin:0; color: red; background-color: blue; width: 1px; height: 1px;">*</div>');
and then try to reproduce the movements
It works fine on most pages, but on some pages, playback starts ("*" starting position) a few pixels to the right (x). Y is fine, but x is about 120px to the right. On other pages, that's for sure. On inaccurate pages, when the mouse approaches the right scroll bar, it goes beyond the right border of the page and creates a horizontal scroll bar.
I think this is due to some CSS style that the page plays on.
Does anyone have an idea what could be causing this? How can I get the actual offset (if there is an offset for such pages)?
Many thanks,
Hernan
- Edited-- Obviously, the offset x is related to the positioning of the main document. The first element gives $ .position () of 0.134, and if I EXIST this amount from the recorded data, the reproduction will be accurate. The problem is that this offset does not occur on every page, and I donโt know how to determine when the offset occurs and when not (to fix it by subtraction).
Hernan M.
source share