Skip to content

Commit b80fe3c

Browse files
committed
Completed lesson 21
Faster, Cupertino jogger boy!
1 parent 609c1b0 commit b80fe3c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

21 - Geolocation/index-START.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +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+
navigator.geolocation.watchPosition((data) => {
63+
console.log(data);
64+
speed.textContent = data.coords.speed;
65+
arrow.style.transform = `rotate(${data.coords.heading}deg)`;
66+
})
67+
6068
</script>
6169
</body>
6270
</html>

0 commit comments

Comments
 (0)