Google Maps Practice Pen
How do I make an google maps practice pen?
Warming up to the google maps api. Use a button to set the map to user's coordinates.. What is a google maps practice pen? How do you make a google maps practice pen? This script and codes were developed by Tobi Weinstock on 02 September 2022, Friday.
Google Maps Practice Pen - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Google Maps Practice Pen</title> <link rel='stylesheet prefetch' href='http:////netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="map-canvas"> <i class="icon-spinner icon-spin" id="spinner"></i>
</div>
<p> <button onclick="geoFindMe()"> Set map to my current location </button> <span class="output"></span>
</p> <script src='https://maps.googleapis.com/maps/api/js'></script> <script src="js/index.js"></script>
</body>
</html>
Google Maps Practice Pen - Script Codes CSS Codes
#map-canvas { width: 500px; height: 400px; background-color: #ccc; display: flex; justify-content: center; align-items: center;
}
.icon-spin { font-size: 44px; display: none;
}
Google Maps Practice Pen - Script Codes JS Codes
function geoFindMe() { var spinner = document.getElementById('spinner'); var output = document.getElementsByClassName('output'); spinner.style.display = 'inline-block'; if (!navigator.geolocation) { output.innerHTML = "Geolocation is not supported in your browser"; return; }; function success(position) { userLat = position.coords.latitude; userLong = position.coords.longitude; console.log(userLat, userLong); var mapCanvas = document.getElementById('map-canvas'); var mapOptions = { center: new google.maps.LatLng(userLat, userLong), zoom: 11, mapTypeId: google.maps.MapTypeId.HYBRID } var map = new google.maps.Map(mapCanvas, mapOptions); }; function error() { output.innerHTML = "Unable to retrieve your location"; }; navigator.geolocation.getCurrentPosition(success, error);
}
Developer | Tobi Weinstock |
Username | tvweinstock |
Uploaded | September 02, 2022 |
Rating | 3 |
Size | 2,221 Kb |
Views | 40,480 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
A Pen by Tobi Weinstock | 3,159 Kb |
Emoji Ajax Type Ahead | 4,619 Kb |
Love for Paris | 2,502 Kb |
React Tabs | 3,970 Kb |
World Clock v2 | 0 Kb |
Flexbox World Clock | 4,224 Kb |
Paparazzi Drone | 2,608 Kb |
French Words v2 | 7,485 Kb |
SVG Picnic Pattern | 1,637 Kb |
Personal SVG Logo | 2,168 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Twitch | SarahDunlap | 2,937 Kb |
Cloudy Spiral CSS animation | Hakimel | 6,587 Kb |
CSS Hover Effects | Alen | 3,613 Kb |
Filtre ile Arama Kutusu - Search Box with Filter | AyhanALTINOK | 3,448 Kb |
Comparison of Roboto Draft vs Roboto | Jxnblk | 2,880 Kb |
Static Image to Video Block | Grayghostvisuals | 4,864 Kb |
Experiment | Toddmoy | 2,849 Kb |
Font stack | Adrianjacob | 1,868 Kb |
Responsive slide | Thorien | 2,400 Kb |
Whyutils | LeYvan | 3,752 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!