..got a “tiny little” problem with mouse position after resizing browser window.
I have a form which is displayed on a click event and positoned by script as follows:
$('#whatever').click(function(event){
$('#dialog').css('left', event.pageX);
$('#dialog').css('top', event.pageY);
});
Works fine so the dialog apears on left top of current mouse position.
If I now resize the windows while the dialog is shown, it looses “orientation” 🙂
So I need to refresh to the current mouseposition on
$(window).resize(function(event){
$('#dialog').css('left', event.pageX);
$('#dialog').css('top', event.pageY);
});
But guess what, this does not work. How can I get the position without having a
mousemove or click just after having resized the window – is that possible?
Here is a jsfiddle sample to try out: jsfiddle
Thanks a lot
Raising the click event onResize might work. Try this: