PDA

View Full Version : DIV tag position question



hhpracing
16 Feb 2010, 10:38 AM
I currently have code that is displaying a popup when I click on an image. I have it set to top 5% left 10% but the problem I am having is I want it to display at top 5% left 10% at the current page x y coordinates that I am at, instead of at the very top of the page.

Right now say I am in a shopping cart with several lines and I have scrolled down near the bottom of the page. When I click on image instead of display popup where I am it is at very top and unless I scroll back up I never see popup.

Here is the current code I have in place.
<div id="HelpWindow" style=" position:absolute; z-index:1000;width: 90%;
height: 90%;
margin: 1px auto;

padding: 2px;
text-align: center; display: none; top:5%; left:10%;"

Wickham
16 Feb 2010, 01:14 PM
The div has position: absolute; so you should be able to position it with top: ??px; left:??px; instead of % and it will either take the top and left positions from the top left corner of the window or the top left corner of any parent container that has position: relative;

You may have to edit the height to px as well.