blob: ed7cc488f3d3f5a2733b74afdd306f63b66bc36c [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<style>
body {
margin: 0;
height: 2000px;
overflow: hidden; /* hide scrollbars */
}
.group {
display: inline-block;
position: relative;
width: 250px;
height: 500px;
}
.container {
width: 200px;
height: 400px;
border: 12px solid black;
padding: 5px;
}
.box {
width: 160px;
height: 160px;
}
.sticky {
position: sticky;
top: 10px;
margin: 20px;
background-color: green;
}
.indicator {
position: absolute;
top: 0;
left: 37px;
background-color: red;
}
</style>
<script>
function doTest()
{
window.scrollTo(0, 100);
}
window.addEventListener('load', doTest, false);
</script>
</head>
<body>
<div class="group">
<div class="indicator box" style="top: 110px;"></div>
<div class="container">
<div class="sticky box"></div>
</div>
</div>
<div class="group" style="top: 100px">
<div class="indicator box" style="top: 37px;"></div>
<div class="container">
<div class="sticky box"></div>
</div>
</div>
<div class="group" style="top: 200px">
<div class="indicator box" style="top: 37px;"></div>
<div class="container">
<div class="sticky box"></div>
</div>
</div>
</body>
</html>