<script> | |
onload = function() { | |
scroller.scrollTop = 100; | |
} | |
</script> | |
<style> | |
#scroller { | |
background: white; | |
height: 200px; | |
overflow: auto; | |
width: 200px; | |
} | |
.sticky { | |
position: relative; | |
top: 100px; | |
height: 50px; | |
background: green; | |
} | |
.spacer { | |
height: 2000px; | |
} | |
</style> | |
<div id="scroller"> | |
<div class="sticky"></div> | |
<div class="spacer"></div> | |
</div> |