Page 1 of 1

Place element at top of viewport

Posted: Mon Dec 17, 2007 12:47 pm
by pickle
Hi all,

I've got a password change form inside an element that will appear when an icon is clicked. This form will be used on a page with a potentially long list, so the user might scroll down a bit first.

I've currently managed to get this form to appear at the top of the page - even if the top of the page is outside the current user's viewport. Is there a way - either with CSS or Javascript - to ensure the form will always appear inside what the user is currently looking at? I'm sure there's a window variable available to Javascript, but I can't find it anywhere.

Thanks for any & all help.

Posted: Mon Dec 17, 2007 2:07 pm
by feyd
Are you referring to something like the floating pane we have from the "RTM-ize" button?

Posted: Mon Dec 17, 2007 2:20 pm
by pickle
Yep, exactly. I hadn't noticed it always shows up in the viewport.

For posterity's sake, the solution was:

Code: Select all

window.pageYOffset
Thanks.