How to fix background positioning problem?http://forums.asp.net/t/1775651.aspx/1?How+to+fix+background+positioning+problem+Thu, 01 Mar 2012 17:08:19 -050017756514859309http://forums.asp.net/p/1775651/4859309.aspx/1?How+to+fix+background+positioning+problem+How to fix background positioning problem? <p>Hi,</p> <p>I use a script for a popup. This works great, but when the popup comes foreward, the background jumps to the top position. That is not what I want. The background page is large and de popup is only for aditional information. When the visitor clicks it away, he must can continue where he left. How can I fix this? What element in the script is responsible for repositioning the background?</p> <p></p> <p>&lt;/script&gt;</p> <p>&lt;script type=&quot;text/javascript&quot;&gt;<br> function showPopUp(el) {<br> var cvr = document.getElementById(&quot;cover&quot;)<br> var dlg = document.getElementById(el)<br> cvr.style.display = &quot;block&quot;<br> dlg.style.display = &quot;block&quot;<br> if (document.body.style.overflow = &quot;hidden&quot;) {<br> cvr.style.width = &quot;1024&quot;<br> cvr.style.height = &quot;100%&quot;<br> }<br> }<br> function closePopUp(el) {<br> var cvr = document.getElementById(&quot;cover&quot;)<br> var dlg = document.getElementById(el)<br> cvr.style.display = &quot;none&quot;<br> dlg.style.display = &quot;none&quot;<br> document.body.style.overflowY = &quot;scroll&quot;<br> }<br> &lt;/script&gt;<br> &lt;style type=&quot;text/css&quot;&gt;<br> #cover {<br> display:none;<br> position:absolute;<br> left:0px;<br> top:0px;<br> width:100%;<br> height:100%;<br> background:gray;<br> filter:alpha(Opacity=80);<br> opacity:0.5;<br> -moz-opacity:0.5;<br> -khtml-opacity:0.5<br> }<br> #dialog {<br> display:none;<br> left:100px;<br> top:50px;<br> width:680px;<br> height:700px;<br> position:absolute;<br> z-index:1000;<br> background:white;<br> padding:0px;<br> font:10pt verdana;<br> border:0px solid gray<br> }<br> &lt;/style&gt;</p> <p>&lt;/head&gt;</p> <p>&lt;div id=&quot;cover&quot;&gt;&lt;/div&gt;<br> &lt;div id=&quot;dialog&quot;&gt;<br> &lt;iframe width=&quot;680&quot; height=&quot;700&quot; src=&quot;#&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;<br> &lt;br&gt;&lt;a href=&quot;#&quot; onclick=&quot;closePopUp('dialog');&quot;&gt;&lt;input type=&quot;button&quot; value=&quot;close&quot; /&gt;&lt;/a&gt;&lt;/div&gt;<br> &lt;a href=&quot;#&quot; onclick=&quot;showPopUp('dialog');&quot; style=&quot;text-decoration: none&quot;&gt;show popup&lt;/a&gt;</p> 2012-03-01T15:56:26-05:004859330http://forums.asp.net/p/1775651/4859330.aspx/1?Re+How+to+fix+background+positioning+problem+Re: How to fix background positioning problem? <p>Well I pasted your code and I can't reproduce the issue you're getting.</p> <p>Eitherway try returning false when firing the javascript:<br> <br> &lt;a href=&quot;#&quot; onclick=&quot;closePopUp('dialog');return false&quot;&gt;&lt;input type=&quot;button&quot; value=&quot;close&quot; /&gt;&lt;/a&gt;<br> &lt;a href=&quot;#&quot; onclick=&quot;showPopUp('dialog');return false&quot; style=&quot;text-decoration: none&quot;&gt;show popup&lt;/a&gt;</p> <p>&nbsp;</p> 2012-03-01T16:09:16-05:004859410http://forums.asp.net/p/1775651/4859410.aspx/1?Re+How+to+fix+background+positioning+problem+Re: How to fix background positioning problem? <p>Thanks CollyMelon,</p> <p>What now happend is that the baground is blocked and the popup is shown on top&nbsp;at the same place as before...</p> <p>Is seems that the whole script is related to the absolute 0 of the web page.</p> 2012-03-01T17:08:19-05:00