# Having a div follow the user as they scroll - xhtml/js

**URL:** <https://forum.kirupa.com/t/having-a-div-follow-the-user-as-they-scroll-xhtml-js/158178>\
**Category:** web dev\
**Created:** [August 8, 2005, 12:45am UTC](https://forum.kirupa.com/t/having-a-div-follow-the-user-as-they-scroll-xhtml-js/158178 "2005-08-08T00:45:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JRPereira](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@JRPereira](https://forum.kirupa.com/u/JRPereira)\
**Post date:** [August 8, 2005, 12:45am UTC](https://forum.kirupa.com/t/having-a-div-follow-the-user-as-they-scroll-xhtml-js/158178/1 "2005-08-08T00:45:02Z")

</div>

I’m trying to figure out how to make this work with xhtml strict, but I haven’t been able to figure out how to set the “top” property of the div in firefox (I can get it to work with IE), and with both firefox and ie I can’t seem to retrieve a value like document.body.scrollTop or window.pageYOffset (so I can use it to move the div).

[http://pjrp.unleashed.ws/testjs.shtml](http://pjrp.unleashed.ws/testjs.shtml)

Any ideas?
