ALawrence007
asked on
Find Center Right of screen using JQuery
Hi to all,
I have a Visual Studio 2008 ASP.Net application. This application is written in VB.Net. I use the JQuery Library for most of my JavaScript.
I am using the code below to display a div for pop up. As you can see the div pops up where the mouse is clicked. I want to display the pop up in the middle right of the page. How would I do that?
I am working of a sample below and am still learning JavaScript
I have a Visual Studio 2008 ASP.Net application. This application is written in VB.Net. I use the JQuery Library for most of my JavaScript.
I am using the code below to display a div for pop up. As you can see the div pops up where the mouse is clicked. I want to display the pop up in the middle right of the page. How would I do that?
I am working of a sample below and am still learning JavaScript
$(function() {
$(document).click(function(e) {
//getting height and width of the message box
var height = $('#popuup_div').height();
var width = $('#popuup_div').width();
//calculating offset for displaying popup message
leftVal = e.pageX - (width / 2) + "px";
topVal = e.pageY - (height / 2) + "px";
//show the popup message and hide with fading effect
$('#popuup_div').css({ left: leftVal, top: topVal }).show().fadeOut(1500);
});
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER