I am trying to develop the following functionality for the sidebar. In a nutshell, the sidebar will have a height of 100% and will be absolutely positioned. Inside it there is content that should scroll with the page, and the sidebar is fixed. And as an add-on there is a shadow effect / response to show the user whether he can scroll down or up. For example, if there is something that you can scroll down / up, show the shadow there if you do not show the shadow. I made a quick layout, I hope this helps you understand what happens if the page scrolls:

I made a quick jsfidle with the content and sidebar, this is how much I can get at the moment. http://jsfiddle.net/cJGVJ/3/ I assume that this cannot be achieved only with css and html and work with a cross browser, so jQuery solutions are welcome.
HTML
<div id="main"> </div> <aside id="sidebar"> <div id="side-content-1"></div> <div id="side-content-2"></div> </aside>
CSS
body { background: #f3f3f3; margin: 0; padding: 0; } #page-wrapper { width: 90%; margin: 0 auto; overflow: hidden; } #sidebar { width: 30%; float: left; background: #ffffff; padding: 10px; height: 100%; position: fixed; } #main { width: 60%; float: right; } #side-content-1, #side-content-2 { height: 400px; } #side-content-1 { background: red; opacity: 0.4; } #side-content-2 { background: green; opacity: 0.4; margin-top: 10px; }
EDIT The caring content in the sidebar sums up to less than one page content, so when it reaches the bottom (therefore, when the bottom shadow disappears), it should stay there while the main content can be scrolled down.
javascript jquery html css
Ilja
source share