-
Notifications
You must be signed in to change notification settings - Fork 0
/
catroll.html
71 lines (54 loc) · 1.22 KB
/
catroll.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
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<style>
.lois-photo {
transition: 5s;
-webkit-transition: 5s;
}
.catroll-holder {
font-size: 30px;
width: 100%;
overflow: hidden;
margin: 0 -20px 0 -20px;
}
#lois-holder {
transition: 5s;
-webkit-transition: 5s;
margin-left: -320px;
width: 450px;
}
.lois-spacer {
width: 100px;
display: inline-block;
}
</style>
</head>
<body onkeydown="rollLois(event)">
<p>Press ctrl</p>
<div class="catroll-holder">
<div id="lois-holder">
<p class="lois-spacer"></p>
<img class="lois-photo"
alt="CAT PHOTO"
src="lois.bmp">
</div>
</div>
<script type="text/javascript">
function rollLois(e) {
var ctrlKeyPressed = e.ctrlKey;
var lois = document.getElementsByTagName("img")[0];
var loisHolder = document.getElementById("lois-holder");
if (ctrlKeyPressed == true)
{
lois.style.transform = "rotate(1080deg)";
loisHolder.style.margin = "0px 0px 0px 1000px";
window.setInterval( function resetLois() {
lois.style.transform = "rotate(-720deg)";
loisHolder.style.margin = "0px 0px 0px -400px";
}, 5000);
};
};
</script>
</body>
</html>