-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from abiral2057/geoapi
Added @abiral2057 's file in participants. Used Geo Location API
- Loading branch information
Showing
6 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
function findMe(){ | ||
const status = document.querySelector("#status"); | ||
const coordinate = document.querySelector('#coordinate'); | ||
const coordinatedetail = document.querySelector('#coordinatedetail'); | ||
|
||
|
||
coordinate.href=""; | ||
coordinate.textContent=""; | ||
|
||
function success(position){ | ||
const latitude = position.coords.latitude; | ||
const longitude = position.coords.longitude; | ||
|
||
status.textContent="Success"; | ||
coordinate.href =`https://www.google.com/maps/@${latitude},${longitude},163m/data=!3m1!1e3?entry=ttu` | ||
coordinate.textContent =`Click Here`; | ||
|
||
coordinatedetail.textContent = `Latitude : ${latitude} , Longitude : ${longitude}`; | ||
|
||
} | ||
function error(){ | ||
status.textContent = "Unable to Find your Location"; | ||
} | ||
if(!navigator.geolocation){ | ||
status.textContent="Geolocation NOT SUPPORTED"; | ||
|
||
} | ||
else{ | ||
status.textContent = "Searching .... ."; | ||
navigator.geolocation.getCurrentPosition(success,error); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!-- Using GeoAPI --> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>GeoLocation API</title> | ||
<link rel="stylesheet" href="style.css" type="text/css"> | ||
<script src="app.js" type="text/javascript"></script> | ||
</head> | ||
<body> | ||
<div class="location-title"> | ||
<h1 id="locationtitle">GEOLOCATION API</h1> | ||
<img id="animearth" src="earth.gif" alt="Rotating Earth"> | ||
</div> | ||
|
||
<div class="location-body"> | ||
<button id="search" onclick="findMe()">Find your Location <span><img class="placeholder" src="placeholder.png"></span></button> | ||
<h3 id="status">Check Status</h3> | ||
<p id="coordinatedetail">Please Click Button to Get your Location </p> | ||
<span id="text"><a id="coordinate" target="_blank"></a></span> | ||
</div> | ||
|
||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
.location-title{ | ||
|
||
display: flex; | ||
justify-content: center; | ||
} | ||
#animearth{ | ||
width: 120px; | ||
height: 120px; | ||
} | ||
|
||
#locationtitle{ | ||
margin-top: 40px; | ||
} | ||
|
||
.location-body{ | ||
display: flex; | ||
align-content: center; | ||
align-items: center; | ||
justify-content: space-evenly; | ||
flex-wrap: wrap; | ||
flex-direction: column; | ||
} | ||
#search{ | ||
outline: none; | ||
font-weight: 600; | ||
color: cadetblue; | ||
font-size: 20px; | ||
outline-color: none; | ||
border-radius: 4px; | ||
} | ||
.placeholder{ | ||
width: 20px; | ||
} | ||
body{ | ||
margin-top: 150px; | ||
} |