I could use some guidance. I have built a map using Google Maps Javascript API, and I receive no errors on load - but the map isn't displaying. The DOM element is active; the javascript file loads; html and css styling are all in place. API key is active, and restricted to my domain. So I'm really just not sure what I'm doing wrong. You can see a live demo of this issue by going to https://www.copelandcompany.com/visit-us/, and scrolling just below the fold. That white space should be the map.
While there are no errors now, what DOES throw errors is when I add "async defer" to the Google Maps javascript, or when I add "callback:initMap" to the API url. So I removed those things, and there's no scripting errors.
But - no map.
Here's my code. Any help is appreciated, thanks!
Loaded at the bottom of the header:
<script src="https://www.copelandcompany.com/wp-content/themes/pinnacle_child/cco-map.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YESILOADEDMYAPIKEYHERE"></script>
Here's my cco-map.js file code:
// Google Maps Code
function initMap () {
var cco_office = {lat: 26.687469, lng: -80.054225};
var cco_map = new google.maps.Map(document.getElementById('cco-map'), {
zoom: 15,
center: cco_office
});
var contentString =
'<div id="cco-marker">'+
'<img src="/wp-content/uploads/2015/04/DSC_0195.jpg" />'+
'<h3 style="font-family: Raleway;">Copeland & Co. Real Estate</h3>'+
'<div id="bodyContent">'+
'<b>Address:</b> 2822B S Dixie Hwy, West Palm Beach, FL 33405' +
'<p><b>Phone:</b> 561-500-LIST (5478)<br>'+
'<b>Email:</b> [email protected]</br>'+
'<b>Hours:</b> Monday-Friday, 9:00 a.m. to 5:00 p.m.<br>'+
'<div class="links"><a href="https://www.google.com/maps/dir//Copeland+%26+Co.+Real+Estate,+2822+S+Dixie+Hwy,+West+Palm+Beach,+FL+33405/@26.687469,-80.054225,15z/data=!4m8!4m7!1m0!1m5!1m1!1s0x88d8d7aa6a149623:0xde07abb7d8b409f4!2m2!1d-80.054225!2d26.687469" target="_blank" title="Directions" />Get Directions</a> | <a href="https://www.google.com/maps/place/Copeland+%26+Co.+Real+Estate/@26.6874738,-80.0564137,17z/data=!4m7!3m6!1s0x0:0xde07abb7d8b409f4!8m2!3d26.687469!4d-80.054225!9m1!1b1" target="_blank" title="Reviews" style="color: #EB6E00;" />Read Our 5-Star Reviews</a></div>'+
'</div>'+
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var cco_marker = new google.maps.Marker({
position: cco_office,
map: cco_map,
title: 'Copeland & Co. Real Estate'
});
cco_marker.addListener('click', function() {
InfoWindow.open(cco_map, cco_marker);
});
}
Loaded by style.css:
#cco-map {
width: 100%;
height: 400px;
}
And my HTML:
<div id="cco-map"></div>


initMapsomewhere? The posted code works for me (fiddle) if I callinitMapon page load.