-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorldMapcup3.html
449 lines (389 loc) · 14.5 KB
/
WorldMapcup3.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>World Map Cup - Challenge #3</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.46.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.46.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<style>
.mapboxgl-ctrl.mapboxgl-ctrl-attrib {
background-color: rgba(86, 1, 1, 0.7) !important;
}
.mapboxgl-ctrl.mapboxgl-ctrl-attrib a {
color: #d17d61 !important;
}
/* Blue + Amber zoom controls */
.mapboxgl-ctrl-group {
background-color:rgba(86, 1, 1, 0.7) !important;
color: #d17d61 !important;
border: 1px solid #d17d61 !important;
}
.mapboxgl-ctrl-group > button + button {
border-top: 1px solid #d17d61 !important;
}
/* Takes default icon image URI and swaps the colors in the svg code to Amber */
.mapboxgl-ctrl-icon.mapboxgl-ctrl-zoom-out {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%0A%20%20%3Cpath%20style%3D%27fill%3A%23d17d61%3B%27%20d%3D%27m%207%2C9%20c%20-0.554%2C0%20-1%2C0.446%20-1%2C1%200%2C0.554%200.446%2C1%201%2C1%20l%206%2C0%20c%200.554%2C0%201%2C-0.446%201%2C-1%200%2C-0.554%20-0.446%2C-1%20-1%2C-1%20z%27%20%2F%3E%0A%3C%2Fsvg%3E%0A") !important;
}
.mapboxgl-ctrl-icon.mapboxgl-ctrl-zoom-in {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%0A%20%20%3Cpath%20style%3D%27fill%3A%23d17d61%3B%27%20d%3D%27M%2010%206%20C%209.446%206%209%206.4459904%209%207%20L%209%209%20L%207%209%20C%206.446%209%206%209.446%206%2010%20C%206%2010.554%206.446%2011%207%2011%20L%209%2011%20L%209%2013%20C%209%2013.55401%209.446%2014%2010%2014%20C%2010.554%2014%2011%2013.55401%2011%2013%20L%2011%2011%20L%2013%2011%20C%2013.554%2011%2014%2010.554%2014%2010%20C%2014%209.446%2013.554%209%2013%209%20L%2011%209%20L%2011%207%20C%2011%206.4459904%2010.554%206%2010%206%20z%27%20%2F%3E%0A%3C%2Fsvg%3E%0A") !important;
}
.mapboxgl-ctrl-icon.mapboxgl-ctrl-compass > .mapboxgl-ctrl-compass-arrow {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%0A%09%3Cpolygon%20fill%3D%27%23d17d61%27%20points%3D%276%2C9%2010%2C1%2014%2C9%27%2F%3E%0A%09%3Cpolygon%20fill%3D%27%23784a3a%27%20points%3D%276%2C11%2010%2C19%2014%2C11%20%27%2F%3E%0A%3C%2Fsvg%3E") !important;
}
</style>
<style> <!-- Popup Style -->
/* Marker tweaks */
.mapboxgl-popup-close-button {
display: none;
}
.mapboxgl-popup-content {
font: 400 15px/18px 'Source Sans Pro', 'Helvetica Neue', Sans-serif;
padding: 0;
width: 180px;
}
.mapboxgl-popup-content-wrapper {
padding: 1%;
}
.mapboxgl-popup-content h3 {
background: #717171;
color: #fff;
margin: 0;
display: block;
padding: 10px;
border-radius: 3px 3px 0 0;
font-weight: 700;
margin-top: -15px;
}
.mapboxgl-popup-content h4 {
margin: 0;
display: block;
padding: 10px;
font-weight: 400;
}
.mapboxgl-popup-content div {
padding: 10px;
}
.mapboxgl-container .leaflet-marker-icon {
cursor: pointer;
}
.mapboxgl-popup-anchor-top > .mapboxgl-popup-content {
margin-top: 15px;
}
.mapboxgl-popup-anchor-top > .mapboxgl-popup-tip {
border-bottom-color: #91c949;
}
</style>
<style>
#map {
position: fixed;
width:50%;
}
#features {
width: 50%;
margin-left: 50%;
font-family: Tw Cen MT;
overflow-y: scroll;
background-color: #fafafa;
}
section {
padding: 25px 50px;
line-height: 25px;
border-bottom: 1px solid #ddd;
opacity: 0.25;
font-size: 20px;
}
section.active {
opacity: 1;
}
section:last-child {
border-bottom: none;
margin-bottom: 400px;
}
</style>
<style>
.active {
opacity = 0.5;
font-weight:200;
font: 16px/26px 'Helvetica Neue', Arial, Helvetica, sans-serif;
font-weight: bold;
}
.active h3 {
color: rgba(86, 1, 1, 0.7);
font-family: Verdana;
}
.active div span {
background: rgba(255, 255, 255, 0.5);
}
</style>
<style>
.legend {
background: rgba(255, 255, 255, 0.5);
border-radius: 3px;
border-style: solid;
border-width: 5px;
border-color: #1da1ab;
box-shadow: 0 1px 2px rgba(0,0,0,0.10);
font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;
padding: 10px;
position: absolute;
left=5px;
top: 5px;
z-index: 1;
opacity = 0.5;
}
.legend h3 {
background: #808080;
color: #fff;
margin: +10px;
display: block;
padding: 10px;
width: 220px;
border-radius: 3px 3px 0 0;
font-size: large;
margin-top: -10px;
margin-right:-10px;
margin-left:-10px;
padding-left:5em;
}
.legend div span {
display:block;
float:left;
height:15px;
width:100%;
text-align:center;
font-size:12px;
background: rgba(255, 255, 255, 0.5);
}
</style>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
<div id='state-legend' class='legend'>
<h3>Map Key</h3>
<div><span style='background: rgb(254, 229, 217, 0.7)'><b>Group Least Likely to Win<b/></span></div>
<div><span style='background: rgba(215, 48, 39, 0.7)'><b>2nd Group<b/></span></div>
<div><span style='background: rgba(252, 146, 114, 0.7)'><b>3rd Group<b/></span></div>
<div><span style='background: rgba(251, 107, 75, 0.7)'><b>4th Group<b/></span></div>
<div><span style='background: rgba(203, 24, 29, 0.7)'><b>5th Group<b/></span></div>
<div><span style='background: rgba(153, 0, 13, 0.7)'>6th Group<b/></span></div>
<div><span style='background: rgba(86, 1, 1, 0.7)'><b>Most Likely to Win<b/></span></div>
<small>Source: <a href="https://eeecon.uibk.ac.at/~zeileis/assets/posts/2018-05-30-fifa2018/fifa2018.csv">Probabilistic Forecasting for the 2018 FIFA World Cup
</a></small>
</div>
<div id='map'></div>
<div id='features'>
<section id='welcome' class='active'>
<h3>#Football's NOT Coming Home</h3>
<p>This interactive map tells England's Story to the FIFA World Cup Semi-Finals 2018. By clicking on each nation, you can also see the probability (rank) of each nation's chance (who qualified) to win the World cup, based on the Leitner et al.(2010) bookmaker consensus model.</p>
</section>
<section id='section1' class='active'>
<h3>England 1966 </h3>
<p>English fans across the country have been dreaming about another World cup win for the past days, reminiscing of the 1966 Bobby Moore days. With England in the semi-finals and with it's strongest team it's had in over 10 years, surely football would be coming home.
<br><br> <img src="http://e1.365dm.com/16/07/16-9/20/world-cup-bobby-moore-trophy_3752662.jpg?20160727125303" width='480' ><br><br></p>
</section>
<section id='section2' class='active'>
<h3>Semi-finals: England vs Croatia</h3>
<p>At half time, England dominated Croatia 1-0 up and it looked like England would reach the finals of the 2018 World Cup. However, it was clear after half time, a tired England squad was under pressure from the strong Croatian side, who equalized 1-1. In extra-time, Croatia scored another goal, which meant football is NOT #cominghome this year.<br><br> <img src="https://ichef.bbci.co.uk/live-experience/cps/624/cpsprodpb/vivo/live/images/2018/7/11/a04e9af2-5dd7-4480-b00d-aabaa66d8eda.jpg" width='480' ><br><br> The match highlights below show how close the game was: <a href="https://www.google.co.uk/search?q=croatia+england&rlz=1C1CHBF_enGB746GB746&oq=croatia+england&aqs=chrome.0.0j69i61j69i60l2j0l2.3481j0j7&sourceid=chrome&ie=UTF-8#sie=m;/g/11gdkqkggh;2;/m/030q7;dt;fp;1">BBC News</a>
<table>
<thead>
<tr>
<th>TEAM STATS</th>
<th>England</th>
<th>Croatia</th>
</tr>
</thead>
<tbody>
<tr>
<td>Score</td>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>Shots</td>
<td>11</td>
<td>22</td>
</tr>
<tr>
<td>Possession</td>
<td>44%</td>
<td>56%</td>
</tr>
<tr>
<td>Pass Accuracy</td>
<td>76%</td>
<td>80%</td>
</tr>
<tr>
<td>Fouls</td>
<td>14</td>
<td>23</td>
</tr>
<tr>
<td>Yellow Cards</td>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>Corners</td>
<td>4</td>
<td>8</td>
</tr>
</tbody>
</table>
</body>
</html></p>
</section>
<section id='section3' class='active'>
<h3>Allez La France!</h3>
<br><br> <img src="https://pbs.twimg.com/media/B68ZHl9IgAILer_.jpg" width='480' >
<p>Despite England's loss, I will still be supporting England this Saturday in the third place play-off and supporting France in the final. France won their first World cup win in 1998, in the Stade de France, Saint-Denis, Paris. The scenes of celebration looked as if the entire population of France had flocked to the streets of the Champs-Élysées. France reached the quarter-finals in Brazil and the last time France reached the World cup final was 2006. <br><br><iframe width="560" height="315" src="https://www.youtube.com/embed/rzO_BNt65Jw" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> </p>
</section>
<section id='section4'class='active'>
<h3>Where I will be watching the match? </h3>
<p> By clicking on both France and Croatia, you can see out of the two, France had the a higher probability of winning the World cup at the start of the World cup. <a href="https://www.cbssports.com/soccer/world-cup/news/france-vs-croatia-world-cup-final-prediction-determining-edge-in-defense-midfield-attack-more/"> CBSsport</a> break down both teams, how they match up and predict a 2-1 victory to France. I'll be watching the match with friends at Einstein Bier Haus, Liverpool (the capital city of football in England ;). With 3.5 billion people estimated to be watching the World Cup this year, let's just hope there are no headbutt's!</p>
<br><br><iframe src="https://giphy.com/embed/MzSDezZ7WXoNq" width="480" height="295" frameBorder="0" class="giphy-embed" allowFullScreen></iframe><p><a href="https://giphy.com/gifs/soccer-headbutt-zidane-MzSDezZ7WXoNq">via GIPHY</a></p>
</section>
</div>
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoidGFzdGF0aGFtMSIsImEiOiJjamZ1ejY2bmYxNHZnMnhxbjEydW9sM29hIn0.w9ndNH49d91aeyvxSjKQqg';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/tastatham1/cjjhaxv0hbice2snj81j9ertu',
bearing: -0,
center: [37.52984664657049,55.75369642243939],
zoom: 2,
speed: 1,
pitch: 0
});
map.on("load", function () {
/* Image: An image is loaded and added to the map. */
map.loadImage("https://i.imgur.com/MK4NUzI.png", function(error, image) {
if (error) throw error;
map.addImage("custom-marker", image);
/* Style layer: A style layer ties together the source and image and specifies how they are displayed on the map. */
map.addLayer({
id: "markers",
type: "symbol",
/* Source: A data source specifies the geographic coordinate where the image marker gets placed. */
source: {
type: "geojson",
data: {
type: "FeatureCollection",
features:[{"type":"Feature","geometry":{"type":"Point","coordinates":[-2.980417575139711,53.403152050486426]},
}]}
},
layout: {
"icon-image": "custom-marker",
}
});
});
})
var chapters = {
'welcome': {
bearing: -0,
center: [37.52984664657049,55.75369642243939],
zoom: 2,
speed: 0.8,
pitch: 45,
},
'section1': {
bearing: 0,
center: [-0.279840,51.555672],
speed:0.8,
zoom: 16,
pitch: 45
},
'section2': {
center: [37.553501,55.715526],
bearing: 40,
zoom: 16,
speed:1.2,
pitch: 20
},
'section3': {
bearing: 12.80,
center: [2.295052,48.873704],
zoom: 16,
speed: 1.2,
pitch: 20
},
'section4': {
bearing: 0,
center: [-2.980417575139711,53.403152050486426],
zoom: 16,
speed: 1,
pitch: 45
}
};
// On every scroll event, check which element is on screen
window.onscroll = function() {
var chapterNames = Object.keys(chapters);
for (var i = 0; i < chapterNames.length; i++) {
var chapterName = chapterNames[i];
if (isElementOnScreen(chapterName)) {
setActiveChapter(chapterName);
break;
}
}
};
var activeChapterName = 'welcome';
function setActiveChapter(chapterName) {
if (chapterName === activeChapterName) return;
map.flyTo(chapters[chapterName]);
document.getElementById(chapterName).setAttribute('class', 'active');
document.getElementById(activeChapterName).setAttribute('class', '');
activeChapterName = chapterName;
}
function isElementOnScreen(id) {
var element = document.getElementById(id);
var bounds = element.getBoundingClientRect();
return bounds.top < window.innerHeight && bounds.bottom > 0;
}
map.addControl(new mapboxgl.NavigationControl({ //Add navigation control - North Arrow
position: 'top-right' // position of navigation top-right
}));
map.addControl(new mapboxgl.FullscreenControl()); //Add full screen mode
map.addControl(new mapboxgl.ScaleControl({ //Add scale bar
maxWidth: 300,
unit: 'imperial'
}));
map.on('load', function () {
// When a click event occurs on a feature in the imddata layer, open p
map.on('click', 'worldcup2', function (e) {
new mapboxgl.Popup()
.setLngLat(e.lngLat)
.setHTML("<h3><b>Nation:</b> "+e.features[0].properties.Country + "</h3><h4><b>Semi Final:</b> "+e.features[0].properties.Semi + "</h4><h4><b>Final:</b> "+e.features[0].properties.Final + "</h4><h4><b>Win:</b> "+e.features[0].properties.Win + "</h4><h4><b>World Cup Wins:</b> "+e.features[0].properties.WC_wins + "</h4>")
.addTo(map);
});
// Change the cursor to a pointer when the mouse is over the states layer.
map.on('mouseenter', 'im1', function () {
map.getCanvas().style.cursor = 'pointer';
});
// Change it back to a pointer when it leaves.
map.on('mouseleave', 'worldcup2', function () {
map.getCanvas().style.cursor = '';
});
});
</script>
</body>
</html>