I have seen that this is a common problem, but I can't seem to find a solution on my specific project. The first map opens, but when I click the second tab the map opens but it looks like this screenshot
Here is the link http://cotdigtest5.com/contact.php . You can see the problem when you click on the tabs.
The javascript is:
function displayMap1() {
document.getElementById('map-canvas1').style.display="block";
initialize1();
}
function initialize1() {
var myLatlng = new google.maps.LatLng(6.441648,3.419913);
var myOptions = {
zoom: 14,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map-canvas1"),
myOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map
})
}
function displayMap2() {
document.getElementById('map-canvas2').style.display="block";
initialize2();
}
function initialize2() {
var myLatlng = new google.maps.LatLng(6.441648,3.419913);
var myOptions = {
zoom: 14,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map-canvas2"),
myOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map
})
}
<li><a href="#content-1" onclick="displayMap1()">Map 1</a></li>
<li><a href="#content-2" onclick="displayMap2()">Map 2</a></li>