Skip to content

Instantly share code, notes, and snippets.

@kTmnh
Last active December 11, 2015 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kTmnh/4661261 to your computer and use it in GitHub Desktop.
Save kTmnh/4661261 to your computer and use it in GitHub Desktop.
iOS 6 timer bug test sample. Apparently, Apple fixed the problem on iOS 6.1.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<script>
window.onload = function() {
var element = document.getElementById("test");
var result = document.getElementById("result");
var count = 0;
element.addEventListener("touchend", function() {
//if element fired touchend event, then add texts into the result element.
result.innerHTML += "TouchEnd<br>";
//then also starts the setTimeout timer at the sametime.
setTimeout(function() {
//but this timer doesn't fire if scroll event fires at the top window.
//as a result, this "Timeout" text not inserted if the element flicked down.
result.innerHTML += "Timeout<br>";
}, 10);
});
}
</script>
<style>
#test {
width:200px;
height:200px;
border:1px solid #000000;
-webkit-user-select:none;
}
</style>
</head>
<body>
<div id="test">Tap or flick down me!</div>
<div id="result"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment