-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
88 lines (74 loc) · 1.91 KB
/
index.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
82
83
84
85
86
87
88
<!doctype html>
<head>
<meta charset="utf-8">
<title>cursormove.js demo</title>
<meta name="description" content="jQuery plugin to emit events when the mouse coordinates change">
<meta name="robots" content="noindex, nofollow">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.dot1,
.dot2 {
position: absolute;
border-radius: 50%;
height: 1em;
width: 1em;
top: -1em;
transform: translate(-50%, -50%);
background: red;
pointer-events: none;
}
.box {
margin-top: 8em;
border: solid .2em;
height: 15em;
width: 15em;
position: static;
overflow: auto;
}
.box:before {
content: "";
height: 1000px;
display: block;
background: url(https://placehold.it/80x80/555555);
}
.dot2 {
background: rgb(20, 80, 220);
height: .8em;
width: .8em;
}
body {
height: 1000px;
width: 1000px;
background: url(https://placehold.it/50x50/);
font-family: sans-serif;
margin: 2em;
}
</style>
</head>
<body>
<h1>cursormove.js demo</h1>
<div class="dot1"></div>
<div class="dot2"></div>
<div class="box"></div>
<script src="vendor/jquery.min.js"></script>
<script type="text/javascript" src="cursormove.js"></script>
<script>
$(function() {
$(window).cursormove();
$(window).on("cursormove", function(e, d) {
$(".dot1").css({
left: e.pageX,
top: e.pageY
});
});
$(".box").cursormove();
$(".box").on("cursormove", function(e, d) {
$(".dot2").css({
left: e.pageX,
top: e.pageY
});
});
})
</script>
</body>