I am having an issue with a button on my webpage. When clicked, a pop-up dialog box appears, but it is not centered on the current screen - I have to scroll up to view it and close it each time. I want the pop-up to appear in the center of the current screen no matter where on the page the button is clicked. Can anyone help me with this?
#blanket {background-color:#111;opacity: 0.65;position:absolute;z-index: 9001;top:0px;left:0px;width:100%;}
#popUpDiv {
position:absolute;
background-color:#eeeeee;
border:5px solid #68ad0e;
width:300px;
height:130px;
margin-top:-250px;
margin-left:-23px;
-moz-border-radius: 16px;
-webkit-border-radius: 16px;
border-radius: 16px;
box-shadow: 12px 0 15px -4px #000000, -12px 0 15px -4px #000000;
z-index: 9002;}
Here is the HTML code:
<div id="blanket"></div>
<div id="popUpDiv">
<a href="javascript:void(0)" style="text-decoration: none" onclick="popup('popUpDiv')"><div align="right"><font color="green">close[X]</font> </div></a>
<div align="center">Please Enter Your Area Pincode</div>
</div>
<input type="button" value="pincode" onclick="popup('popUpDiv');">
Is there a JavaScript function that can be added to solve this problem?