-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmagnifyingGlass.html
146 lines (124 loc) · 3.48 KB
/
magnifyingGlass.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-191749773-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-191749773-2');
</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
overflow-y: scroll;
-ms-overflow-style:none;
scrollbar-width:none;
font-family: 'PT Sans', sans-serif;
}
body::-webkit-scrollbar{
display:none;
}
#img-zoomed {
width: 1000px;
height: 100%;
cursor:none;
position: relative;
margin-top: 20px;
margin-left: 12%;
}
#originalImage {
width: 1000px;
height: auto;
}
@media (min-width: 1500px){
#img-zoomed {
width: 1500px;
height: 100%;
cursor:none;
position: relative;
margin-top: 20px;
margin-left: 4%;
}
#originalImage {
width: 1500px;
height: auto;
}
}
#img-zoomed:hover, #img-zoomer-box:active {
cursor: zoom-in;
cursor:none;
}
#img-zoomed:hover #glass,
#img-zoomed:active #glass {
opacity: 1;
}
#glass {
width: 340px;
height: 340px;
background: url('images/compareVer2.jpg') no-repeat ;
pointer-events: none;
position: absolute;
opacity: 0;
border: 10px solid black;
z-index: 99;
border-radius: 100%;
display: block;
}
#textBlock {
width: 500px;
height: 200px;
margin-left: 30%;
margin-top: 20px;
font-size:18px;
justify-content:center;
text-align: center;
background: #f6f5f3;
display:-webkit-box;
display:-ms-flexbox;
display:flex;
-ms-flex-direction:column;
flex-direction:column;
border-radius: 8px;
-webkit-box-shadow: 15px 15px 27px #000000, -15px -15px 27px #000000;
box-shadow: 15px 15px 27px #000000, -15px -15px 27px #000000;
}
</style>
</head>
<body>
<div id="textBlock">
<p style="font-size:120%;"> Spot all of the differences between these two scenes. <br> In each one is a hidden letter. Find all 6 to unscramble the password and unlock this card! <br> This montage dates from 1874 and shows the first first football game played at McGill.</p>
</div>
<div id="img-zoomed">
<img id="originalImage" src="images/compareVer2.jpg">
<div id="glass"></div>
</div>
<script>
var zoom = function (){
document.getElementById('img-zoomed').addEventListener('mousemove', function(e) {
var original = document.getElementById('originalImage'),
magnified = document.getElementById('glass'),
style = magnified.style,
x = e.pageX - this.offsetLeft,
y = e.pageY - this.offsetTop,
imgWidth = original.width,
imgHeight = original.height,
xZoomPos = ((x/imgWidth) * 100),
yZoomPos = ((y/imgHeight) * 100);
if(x > (.01 * imgWidth)) {
xZoomPos += (.15 * xZoomPos);
};
if(y >= (.01 * imgHeight)) {
yZoomPos += (.15 * yZoomPos);
};
style.backgroundPositionX = (xZoomPos - 9) + '%';
style.backgroundPositionY = (yZoomPos - 9) + '%';
style.left = (x - 180) + 'px';
style.top = (y - 180) + 'px';
},
false);
}();
</script>
</body>
</html>