I was in the middle of writing up a long description of what I wanted to do, when I realized that the "How To Ask / Format" sidebar box on this very same "Ask A Question" page does exactly what I want.
Basically, it scrolls up and down in unison with the rest of the screen, staying top-aligned with the main section, unless the main section starts to scroll off the top of the visible window. At that point, the sidebar box stops scrolling, and starts to act as if its positioned absolutely, against the top of the visible window.
I've tried digging into source code and scripts on this "Ask" screen, but there's so much going on that it's pretty much impossible (for me, at least). I'm assuming that jQuery actually makes this kind of thing pretty straightforward, but I'm new to it, so I'm having a hard time figuring it out for myself. (And if this turns out to be a common question, my apologies -- I've been searching for about an hour, but there are so many closely-worded jQuery questions that I haven't been able to dig up an answer.)
Thanks in advance for any help.
if you need to keep it on bottom use as this jQuery
Css
if you need to keep it on top use as this jquery
Css
it will do the magic and dont forget to keep your styles with the positions, and one thing its not work with internet explorer 8.0.7
Here is a little snippet I just whipped up to keep an object on screen while scrolling.
LIVE DEMO
http://jsfiddle.net/Jaybles/C5yWu/
HTML
CSS
jQuery
UPDATED EXAMPLE (With Timer + Animation)
http://jsfiddle.net/Jaybles/C5yWu/2/
And if you only need to hold the div in a some place of the browser you don't need the javascript you can do that with CSS.
This is an example for a shoppingcart Apple has on the Applestore Page.
The logic:
The jQuery:
The CSS:
example Link