-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
62 lines (54 loc) · 2.15 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Those Breeders</title>
<style>
h1 {
text-align: center;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
#breeder-face {
position: fixed;
}
</style>
</head>
<body>
<h1 id="title">Those Breeders</h1>
<img id="breeder-face" src="triple-face.svg" alt="Those Breeders triple face">
<script type="text/javascript" src="http://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-33520998-1']);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
var $window = $(window);
var body = $('body');
var title = $('#title');
var face = $('#breeder-face');
function makeNewPosition() {
var maxXPosition = $window.height() - face.height();
var maxYPosition = $window.width() - face.width();
var x = Math.floor(Math.random() * maxXPosition);
var y = Math.floor(Math.random() * maxYPosition);
return {top: x, left: y};
}
function makeNewColor() {
return '#' + Math.floor(Math.random() * 16777215).toString(16);
}
function animateDiv() {
body.attr('style', 'background-color: ' + makeNewColor());
title.attr('style', 'color: ' + makeNewColor());
face.animate(makeNewPosition(), animateDiv);
}
$(document).ready(animateDiv);
</script>
</body>
</html>