Skip to content

Commit

Permalink
#8.0 Weather API
Browse files Browse the repository at this point in the history
  • Loading branch information
KwanHoo committed Feb 5, 2023
1 parent 71d17ca commit faae841
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index4.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ <h1 id="greeting" class="hidden"></h1>
<form id="todo-form">
<input type="text" placeholder="Write a To do and Press Enter" required>
</form>
<ul id="todo-list"></ul>
<ul id="todo-list">
</ul>
<h2 id="clock">00:00</h2>
<div id="quote">
<span></span>
Expand All @@ -30,6 +31,7 @@ <h2 id="clock">00:00</h2>
<script src="js/quotes.js"></script>
<script src="js/background.js"></script>
<script src="js/todo.js"></script>
<script src="js/weather.js"></script>
</body>

</html>
11 changes: 11 additions & 0 deletions js/weather.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function onGeoOk(position) {
console.log(position);
const lat = position.coords.latitude;
const lng = position.coords.longitude;
console.log("You live in", lat, lng)
}
function onGeoError() {
alert("Can't find you. No weather for you.")
}

navigator.geolocation.getCurrentPosition(onGeoOk, onGeoError)

0 comments on commit faae841

Please sign in to comment.