Thank you for your reply. Your code works, but the coordinates are not accurate. To test this I have hidden the div #status2 with position absolute. On match the div has to show where the mouse was. I have created the following code for this:
- $(function() {
- var mousePos = [0, 0];
- $(document).mouseover(function(e) {
- mousePos = [e.pageX, e.pageY];
- }).
- bind('found_match', function(e) {
- $('#status2').html(mousePos[0] + ', ' + mousePos[1]);
- $("#status2")
- .hide()
- .css({
- top: mousePos[1],
- left: mousePos[0],
- opacity: 1,
- marginTop: 0
- })
- .show()
- .stop();
- });
- });
Result, the div shows, but sometimes just above the mouse, on the next match just right of the mouse and sometimes under the mouse, it's cute random where it shows the div. It does show it near or even on the mouse, but never at the same position (lets say always above the mouse). I would expect the div to always show at the same position of the mouse itself. How to fix this?