SandmanNet
asked on
Scroll DIV with viewport
Ok, so I have a two-column layout that looks something like this:
http://sandman.net/test/move_div.html
And as you can read on that page. I want the blue #side DIV to scroll along on the page WHEN the viewport "hits" it. I.e if I scroll the page 50px nothing will change, the DIV will scroll along with the viewport, but when the browser viewport "hits" it, it will scroll along, to make sure that it's always shown, when I scroll back up it should remain in it's current position.
If you don't understand, follow the instructions to look at the Apple Store, and you should get an idea on what I'd like.
Can this be done in CSS or does it require javascript? Please let me know. If it does equire javascript, please give me tips on how to solve it using jQuery, since that's the framework I'm using.
http://sandman.net/test/move_div.html
And as you can read on that page. I want the blue #side DIV to scroll along on the page WHEN the viewport "hits" it. I.e if I scroll the page 50px nothing will change, the DIV will scroll along with the viewport, but when the browser viewport "hits" it, it will scroll along, to make sure that it's always shown, when I scroll back up it should remain in it's current position.
If you don't understand, follow the instructions to look at the Apple Store, and you should get an idea on what I'd like.
Can this be done in CSS or does it require javascript? Please let me know. If it does equire javascript, please give me tips on how to solve it using jQuery, since that's the framework I'm using.
Alternatively you can just do this using a fixed position div, but you dont get the same nice slide effect as if you were using JS:
<style type="text/css">
#nomove { position:fixed; left:0; top:50px; border: 1px #f00 solid;
}
</style>
<div id="nomove" >stay where you at</div>
<div id="other">this moves </div>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
test
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
n.b. the <br>'s are theye for test purposes to make sure there is a scroll bar in the window. These can obviously be removed.
Open in new window