how to get the top left coordinates of the screen with javascript on firefox
Posted
by artsince
on Stack Overflow
See other posts from Stack Overflow
or by artsince
Published on 2010-04-18T16:58:39Z
Indexed on
2010/04/18
17:03 UTC
Read the original article
Hit count: 316
firefox
|JavaScript
I have a <div>
element with position: absolute
and z-index something big. I would like to cover the entire screen with this div with javascript.
This is what I do and it works:
document.getElementById('mydiv').style.top = 0;
document.getElementById('mydiv').style.left = 0;
document.getElementById('mydiv').style.width = '100%';
document.getElementById('mydiv').style.height = '100%';
However, when I scroll down with long webpages, this code displays my div at the top of the page, so the div renders above the region I currently view. How can I change the top and left values so that my div always covers the active field I am viewing?
I work on firefox 3.6.*.
Thank you
© Stack Overflow or respective owner