I'm currently trying to load a google map based on rather large Ember project.
As the project is quite the load time is longer than what I would like. So due to this I am trying to make the UI of the load page nicer, it's quite bland at the moment. My aim is to implement a simple google map API in to this page that doesn't take long to render and only reads a certain amount of variables e.g. lat, long, zoom level and max zoom.
I also want to load the map asynchronously for performance.
I've put the script in a seperate HTML document below so my other code doesn't make it hard to understand. I'm guessing there is just a silly mistake somewhere in my code.
Big thanks of whoever is able to solve my idiocy in this!
<html>
<head>
<title>Map Load</title>
<style>
#map {
height: 953px;
width: 1630px;
position: absolute;
}
</style>
</head>
<body>
<h1>Loading map using async and defer attributes for loading page</h1>
<div id="map"></div>
<script>
function init() {
var myLatlng = new google.maps.LatLng(54.559322,-4.174804); // Add the coordinates
var mapOptions = {
center: myLatlng,
zoom: 6, // The initial zoom
minZoom: 6, // Minimum zoom
maxZoom: 15 // Maximum zoom
};
var map = new google.maps.Map(document.getElementById('map'), mapOptions); // Render the map within the empty div
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBTy18qtBZ6L1FnlbeVVk2IhMysFBqJb68&callback=init"
async defer></script>
</body>
</html>
initMap, but your function is calledinit.