forked from roboleary/LeapCursor.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
81 lines (53 loc) · 3.55 KB
/
demo.html
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<html>
<head>
<title>LeapCursor.js v0.2 Demo</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="./leapcursor-with-dependencies.min.js?gestureColor=#6DCC44"></script>
<style>
body { overflow-x: hidden; }
p { font-family: Calibri; font-size: 25px; width: 60%; max-width: 750px; margin: 0 auto; padding: 10px; border: 10px solid #FFF; text-align: justify; }
p.title { font-size: 50px; font-weight: bold; color: #6DCC44; }
p a { font-weight: bold; color: #FFF; text-decoration: none; background: #47B6E0; }
#click-notice { display: none; width: 550px; height: 580px; position: absolute; color: #6DCC44; }
#click-notice .handlebar { float: left; font-size: 480px; line-height: 480px; font-family: Times New Roman; }
#click-notice .notice { float: left; margin-top: 240px; padding: 10px; margin-left: -30px; background: #6DCC44; color: #FFF; font-size: 80px; line-height: 80px; }
</style>
</head>
<body>
<div id="click-notice"><div class="handlebar">}</div><div class="notice">CLICK!</div></div>
</body>
<script>
/**
*
*/
function bind(elm, evt, f) {
if (elm.addEventListener) { elm.addEventListener(evt, f, false);
} else if (elm.attachEvent) { elm.attachEvent('on' evt, f); }
}
var paragraph,
content,
clicked,
lorem = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
clickNotice = document.getElementById('click-notice');
for (var i = 0; i < 50; i ) {
paragraph = document.createElement('p');
if (i == 0) {
paragraph.innerHTML = 'LeapCursor.js v0.2 Demo';
paragraph.className = 'title';
} else {
paragraph.innerHTML = lorem;
bind(paragraph, 'mouseenter', function() { this.style.background = '#E3F5DC'; });
bind(paragraph, 'mouseleave', function() { this.style.background = 'none'; });
bind(paragraph, 'click', function() {
if (clicked) { clicked.style.border = '10px solid #FFF'; }
this.style.border = '10px solid #6DCC44';
clickNotice.style.top = this.offsetTop;
clickNotice.style.left = this.offsetLeft this.clientWidth 50;
clickNotice.style.display = 'block';
clicked = this;
});
}
document.body.appendChild(paragraph);
}
</script>
</html>