Gracias, ya he hecho algo parecido, y creia que lo tenia ya que 2 mapas iba a perfeccion en firefox, añado un tercero y solo salen dos, no veo el fallo, será alguna tontería.
Ahora lo pruebo en chrome y sale solo 2 mapas pero encima sin marcadores.
Tiene que ser 3 mapas con marcadores y con un infowindows distinto para cada uno. Tambien he probado con tener el script en <head>
Esto es lo que tengo hasta ahora y me siento como para tirar la toalla:
En head:
Código Javascript
:
Ver original<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function start() {
initialize();
}
window.onload = start;
</script>
<script type="text/javascript">
//<![CDATA[
var map = null;
var map2 = null;
var map3 = null;
function initialize() {
var myOptions = {
zoom: 13,
center: new google.maps.LatLng(36.51308543049258, -4.886341094970703),
mapTypeControl: true,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
navigationControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
google.maps.event.addListener(map, 'click', function() {
infowindow.close();
});
var myOptions2 = {
zoom: 13,
center: new google.maps.LatLng(36.488661268293136, -4.986934661865234),
mapTypeControl: true,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
navigationControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map2 = new google.maps.Map(document.getElementById("map_canvas2"),
myOptions2);
google.maps.event.addListener(map2, 'click', function() {
infowindow.close();
});
var myOptions3 = {
zoom: 13,
center: new google.maps.LatLng(36.51032602426021, -4.794673919677734),
mapTypeControl: true,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
navigationControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map3 = new google.maps.Map(document.getElementById("map_canvas3"),
myOptions3);
google.maps.event.addListener(map3, 'click', function() {
infowindow.close();
});
// Add markers to the map
// Markers map (Marbella town)
var point = new google.maps.LatLng(36.509653404078676, -4.91289496421814);
var marker = createMarker(point,'<div style="width:240px">text here <a href="link here">Link<\/a><\/div>')
// Add markers to the map
// Markers map2 (Puerto Banus)
var point = new google.maps.LatLng(36.502530170146976, -4.951658248901367);
var marker2 = createMarker(point,'<div style="width:240px">text here<a href="link here">Link<\/a><\/div>')
// Add markers to the map
// Markers map3 (Marbella east)
var point = new google.maps.LatLng(36.50598,-4.809995);
var marker3 = createMarker(point,'<div style="width:240px">text here<a href="link here">Link<\/a><\/div>')
}
var infowindow = new google.maps.InfoWindow(
{
size: new google.maps.Size(150,50)
});
function createMarker(latlng, html) {
var contentString = html;
var marker = new google.maps.Marker({
position: latlng,
map: map,
zIndex: Math.round(latlng.lat()*-100000)<<5
});
var marker2 = new google.maps.Marker({
position: latlng,
map: map2,
zIndex: Math.round(latlng.lat()*-100000)<<5
});
var marker3 = new google.maps.Marker({
position: latlng,
map: map3,
zIndex: Math.round(latlng.lat()*-100000)<<5
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(contentString);
infowindow.open(map,marker);
});
google.maps.event.addListener(marker2, 'click', function() {
infowindow.setContent(contentString);
infowindow.open(map2,marker2);
});
google.maps.event.addListener(marker3, 'click', function() {
infowindow.setContent(contentString);
infowindow.open(map3,marker3);
});
}
</script>
</head>
En <body>
Código HTML:
Ver original<div id="map_canvas" style="width: 580px; height: 400px"></div> <div id="map_canvas2" style="width: 580px; height: 400px"></div> <div id="map_canvas3" style="width: 580px; height: 400px"></div>
Gracias