Gmaps.js with refresh location button
How do I make an gmaps.js with refresh location button?
What is a gmaps.js with refresh location button? How do you make a gmaps.js with refresh location button? This script and codes were developed by Gabriel on 12 August 2022, Friday.
Gmaps.js with refresh location button - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>gmaps.js with refresh location button</title> <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCIUs5TE6uZAkb4H52mTg-C-ob0OJmc--A"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/gmaps.js/0.4.23/gmaps.min.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ body { text-align: center;
}
#gmapcood { margin: 10px auto; width: 90%; margin: 10px auto; height: 260px;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <h1>gmaps.js with refresh location button</h1>
<div id="gmapcood"></div> <script src="js/index.js"></script>
</body>
</html>
Gmaps.js with refresh location button - Script Codes CSS Codes
body { text-align: center;
}
#gmapcood { margin: 10px auto; width: 90%; margin: 10px auto; height: 260px;
}
Gmaps.js with refresh location button - Script Codes JS Codes
var onSuccess = function(position) { console.log(position); var map = new GMaps({ div: '#gmapcood', lat: position.coords.latitude, lng: position.coords.longitude, disableDefaultUI: true, zoom: 17, }); map.addMarker({ lat: position.coords.latitude, lng: position.coords.longitude, title: 'Your current location', }); map.addControl({ position: 'top_right', content: 'Refresh', style: { margin: '5px', padding: '4px 8px', border: 'solid 1px #717B87', background: '#fff' }, events: { click: function() { document.querySelector('#gmapcood').innerHTML = ""; initMap(); } } });
};
var onError = function(error) { alert(error.message + '\n(Code: ' + error.code + ')');
}
function initMap() { navigator.geolocation.getCurrentPosition(onSuccess, onError);
}
initMap();
Developer | Gabriel |
Username | gab |
Uploaded | August 12, 2022 |
Rating | 3 |
Size | 2,293 Kb |
Views | 22,264 |
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 |
Css3 background-clip | 2,090 Kb |
A Pen by Gabriel | 2,459 Kb |
Chrome notifications test | 3,589 Kb |
Font awesome Hamburger-Menu-Toggle | 2,191 Kb |
CSS3 Login | 3,115 Kb |
Loggy.js - CSS formatted JS console logs | 2,204 Kb |
Replace a not existing img | 2,026 Kb |
Animated Trash Icon pure CSS | 3,853 Kb |
Projects page | 4,147 Kb |
BEST PLACEHOLDING SERVICES | 6,317 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 |
Basic HTML5 Structure | YuvarajTana | 1,289 Kb |
Slider css only | Armandobau | 2,161 Kb |
Boom | Mhrjnsa1 | 1,794 Kb |
Playing with transition timing | Mattgrosswork | 1,993 Kb |
A Pen by Ben Babics | Benbabics | 2,957 Kb |
Default Input, Textareas, Submits, and Buttons in iOS | Demersdesigns | 2,334 Kb |
Algorithm practice | Abensur | 5,620 Kb |
A Pen by James Podles | Jpod | 2,656 Kb |
3D flipping card | Ssaakkaa | 2,238 Kb |
3D Text in Sass | Bookcasey | 2,766 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!