jautrus
09-10-2006, 10:56 PM
Hi, i have one big headache...
I need to display a DIV (400px by 300px) in EXACT center (vertical and horizontal) of the browser window in response of some events. It’s not very hard to do this by making the DIV position absolute and calculating and setting its left and top values. Problem arises when user scrolls the page and then DIV is displayed. Now DIV does not account for the scroll.
What I need is a solution to EXACTLY center (horizontally and vertically) a DIV in a browser window whenever it is displayed, regardless of browser window size or screen resolution or the amount of page that has been scrolled. If it keeps its center position even after being displayed and scrolled by the user then it would be much better.
The solution should work at least with IE and Firefox.
Please help me...
i almost lost the hope.... :/
Here is an image with more explonation: http://www.astavo.lt/div.gif
I need to display a DIV (400px by 300px) in EXACT center (vertical and horizontal) of the browser window in response of some events. It’s not very hard to do this by making the DIV position absolute and calculating and setting its left and top values. Problem arises when user scrolls the page and then DIV is displayed. Now DIV does not account for the scroll.
What I need is a solution to EXACTLY center (horizontally and vertically) a DIV in a browser window whenever it is displayed, regardless of browser window size or screen resolution or the amount of page that has been scrolled. If it keeps its center position even after being displayed and scrolled by the user then it would be much better.
The solution should work at least with IE and Firefox.
Please help me...
i almost lost the hope.... :/
Here is an image with more explonation: http://www.astavo.lt/div.gif