Skip to content

Commit 48e2a15

Browse files
committed
geo-location
1 parent 0b383dd commit 48e2a15

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

21 - Geolocation/index-START.html

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,14 @@ <h1 class="speed">
5757
/*Compass: https://thenounproject.com/search/?q=compass&i=592352*/
5858
</style>
5959
<script>
60-
const arrow = document.querySelector('.arrow');
61-
const speed = document.querySelector('.speed-value');
62-
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.err(err);
69-
alert('HEY! YOU GOTTA ALLOW THAT TO HAPPEN!!!');
70-
});
60+
const arrow = document.querySelector('.arrow')
61+
const speed = document.querySelector('.speed-value')
7162

63+
navigator.geolocation.watchPosition(function(data) {
64+
console.log(data)
65+
speed.textContent = data.coords.speed || 0
66+
arrow.style.transform = `rotate(${data.coords.heading}deg)`
67+
})
7268
</script>
7369
</body>
7470
</html>

0 commit comments

Comments
 (0)