Created
June 15, 2016 12:51
-
-
Save surma/c932ba3edc0375db540d522792ed0b3a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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