open modal window at present cursor position javascript code example
Example: open modal window at present cursor position javascript
$(document).ready(function(){
$('html').click(function(e){
mouseX=e.pageX;
mouseY=e.pageY;
var bodyTop = document.documentElement.scrollTop + document.body.scrollTop;
..
var windowWidth = $(window).outerWidth();
var windowHeight = $(window).outerHeight();
..
if(mouseY-bodyTop+popupHeight > windowHeight)
...
...
$('div').css({position:"absolute",top:popupTop,left:popupLeft});
$('div').show();
});
});