Skip to content

Commit bb0445a

Browse files
committed
finsihed day 21
1 parent 7cf291d commit bb0445a

File tree

4 files changed

+13
-84
lines changed

4 files changed

+13
-84
lines changed

21 - Geolocation/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules

21 - Geolocation/index-START.html

Lines changed: 0 additions & 74 deletions
This file was deleted.

21 - Geolocation/index-FINISHED.html renamed to 21 - Geolocation/index.html

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,8 @@ <h1 class="speed">
5656
}
5757
/*Compass: https://thenounproject.com/search/?q=compass&i=592352*/
5858
</style>
59-
<script>
60-
const arrow = document.querySelector('.arrow');
61-
const speed = document.querySelector('.speed-value');
59+
<script src="speed.js">
6260

63-
navigator.geolocation.watchPosition((data) => {
64-
console.log(data);
65-
speed.textContent = data.coords.speed;
66-
arrow.style.transform = `rotate(${data.coords.heading}deg)`;
67-
}, (err) => {
68-
console.error(err);
69-
});
7061
</script>
7162
</body>
7263
</html>

21 - Geolocation/speed.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const arrow = document.querySelector('.arrow');
2+
const speed = document.querySelector('.speed-value');
3+
4+
navigator.geolocation.watchPosition((data) => {
5+
console.log(data);
6+
speed.textContent = data.coords.speed;
7+
arrow.style.transform = `rotate(${data.coords.heading}deg)`;
8+
}, (err) => {
9+
console.err(err);
10+
alert('HEY! YOU GOTTA ALLOW THAT TO HAPPEN!!!');
11+
});

0 commit comments

Comments
 (0)