Created
August 25, 2014 14:13
-
-
Save arielsalminen/c91f3c2b04331247d953 to your computer and use it in GitHub Desktop.
iOS 8 Safari doesn’t disable scroll events anymore (A test page).
This file contains 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> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>iOS 8 scrolls</title> | |
<meta name="viewport" content="width=device-width"> | |
</head> | |
<body style="min-height: 20000px;"> | |
<div class="scroller" style="text-align: center; line-height: 4em; position: fixed; top: 0; left: 0; right: 0; height: 4em; background: red; color: #fff; font-family: sans-serif;">We’re here.</div> | |
<script> | |
window.addEventListener("scroll", function (e) { | |
var $el = document.querySelector(".scroller"); | |
var $doc = document.documentElement; | |
var $body = document.body; | |
var top = ($doc && $doc.scrollTop || $body && $body.scrollTop || 0); | |
$el.innerHTML = "We're at " + top + "px"; | |
}, false); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A video: https://www.youtube.com/watch?v=aM5i2V2dB1Q