Skip to content

Instantly share code, notes, and snippets.

@surma
Created June 15, 2016 12:51
Show Gist options
  • Save surma/c932ba3edc0375db540d522792ed0b3a to your computer and use it in GitHub Desktop.
Save surma/c932ba3edc0375db540d522792ed0b3a to your computer and use it in GitHub Desktop.
<!doctype html>
<style>
div {
height: 40px;
background: red;
}
body {
height: 100vh;
}
section {
height: 100vh;
overflow: scroll;
}
span {
display: block;
height: 400vh;
}
</style>
<body>
<section>
<div>Click here, then scroll using the arrow keys</div>
<span></span>
</section>
<script>
const d = document.querySelector('div');
document.querySelector('section').addEventListener('scroll', _ => {
d.parentNode.removeChild(d);
});
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment