forked from ftlabs/fastclick
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path60.html
More file actions
25 lines (25 loc) · 1.01 KB
/
60.html
File metadata and controls
25 lines (25 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<style type="text/css">
p, label { font-family: sans-serif; }
label > a { display: inline-block; background: silver; padding: 0 1em; line-height: 2em; pointer-events: none; }
.test { margin: 2em 0; }
</style>
<title>#60</title>
<script type="application/javascript" src="../lib/fastclick.js"></script>
<script type="application/javascript">
window.addEventListener('load', function() {
new FastClick(document.body);
}, false);
</script>
</head>
<body>
<p>FastClick is instantiated on the document body. A <code>label</code> element is wrapped around an anchor element. Tapping the anchor element should cause the label's the associated input control to gain focus.</p>
<p>This works because the CSS rule <code>label > a { pointer-events: none; }</code> is being used.</p>
<div class="test">
<input type="text" id="test-input"> <label for="test-input"><a href="#">Tap here</a></label>
</div>
</body>
</html>