Skip to content

Instantly share code, notes, and snippets.

@akiyamaSM
Created August 22, 2019 08:38
Show Gist options
  • Save akiyamaSM/96c84a058b332994aa1f0a10a8391071 to your computer and use it in GitHub Desktop.
Save akiyamaSM/96c84a058b332994aa1f0a10a8391071 to your computer and use it in GitHub Desktop.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.container{
background-color: cornflowerblue;
position: relative;
max-height: 500px;
overflow-y: scroll;
width: 700px;
margin: auto;
}
.sous{
border-top: gray solid 1px;
height: 300px;
}
.menu{
position: absolute;
left: -10px;
}
</style>
</head>
<body>
<div class="container" onscroll="onScroll(this)">
<div class="menu">
<ul>
<li> One </li>
<li> two </li>
<li> three </li>
</ul>
</div>
<div class="sous" id="s1">
<h1>Title</h1>
</div>
<div class="sous" id="s2">
<h1>Title</h1>
</div>
<div class="sous" id="s3">
<h1>Title</h1>
</div>
</div>
<script>
function onScroll(o) {
debugger;
/*if(o.offsetHeight + o.scrollTop == o.scrollHeight)
{
alert("End");
}*/
}
function selected() {
console.log('entred');
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment