forked from loganfranken/Cursometer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
42 lines (35 loc) · 866 Bytes
/
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
<!DOCTYPE html>
<html>
<head>
<title>Cursometer Test</title>
<link rel="stylesheet" href="style/screen.css" type="text/css" />
</head>
<body>
<div class="mario"></div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="script/jquery.cursometer.1.0.0.js"></script>
<script type="text/javascript">
$(window.document).cursometer({
onUpdateSpeed: function(speed) {
var currSpeed = parseInt(speed);
var $mario = $('.mario');
var currLeft = $mario.offset().left;
if(currLeft > 900)
{
$mario.css('left', 0);
return;
}
if(currSpeed === 0)
{
$mario.css('background-position', '0 0');
}
else
{
$mario.css('left', '+=' + parseInt(speed));
$mario.css('background-position', '95px 0');
}
}
});
</script>
</body>
</html>