Skip to content

Instantly share code, notes, and snippets.

@bnickel
Created January 12, 2015 21:21
Show Gist options
  • Save bnickel/3b74cd9097f6ea142919 to your computer and use it in GitHub Desktop.
Save bnickel/3b74cd9097f6ea142919 to your computer and use it in GitHub Desktop.
Test page to see how far away from a link you can touch while still tapping it.
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<script src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
<style>
div {
position: absolute;
background-color:green;
left: 100px;
}
#a {
top:100px;
width: 10px;
height: 10px;
}
#b {
top:200px;
width: 30px;
height: 30px;
}
#c {
top:300px;
width: 50px;
height: 50px;
}
#d {
top:400px;
width: 100px;
height: 100px;
}
</style>
<h1>Test</h1>
<span>hi</span>
<div id="a"></div>
<div id="b"></div>
<div id="c"></div>
<div id="d"><a href="javascript:">Link</a></div>
<script>
$('body').on('touchstart', function (event) {
$('span').text(event.originalEvent.touches[0].clientX + ', ' + event.originalEvent.touches[0].clientY)
})
$('#a, #b, #c').click(function(event) {})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment