
06/02/2012, 18:28
|
| | Fecha de Ingreso: julio-2008
Mensajes: 12
Antigüedad: 16 años, 8 meses Puntos: 1 | |
Google Maps Hola tengo la siguiente función que muestra un mapa de google de fondo en mi página web y añade una caja de texto en una coordenada determinada. Lo que quiero hacer es centrar el mapa en un punto y colocar pequeñas marcas que al pasar muestren un texto. Les pongo el código:
Código:
BGMap = (function () {
var map, $mapEl = $('#map'),
address = 'Calle Sin Numero, Avila',
lat = 41.063418,
lng = -4.718995,
display = false,
showMap = function () {
hideMap();
display = true;
var point = new google.maps.LatLng(lat, lng),
mapOptions = {
zoom: 8,
center: point,
mapTypeId: google.maps.MapTypeId.HYBRID,
mapTypeControl: false,
panControl: true,
panControlOptions: {
position: google.maps.ControlPosition.TOP_RIGHT
},
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.SMALL,
position: google.maps.ControlPosition.TOP_RIGHT
},
streetViewControl: true,
streetViewControlOptions: {
position: google.maps.ControlPosition.TOP_RIGHT
}
};
map = new google.maps.Map(document.getElementById("map"), mapOptions);
map.setTilt(45);
resizeMap();
var coordInfoWindow = new google.maps.InfoWindow({
maxWidth: 2
}),
latlngStr = address + "<br />LatLng: " + lat + " , " + lng + "<br />";
coordInfoWindow.setContent(latlngStr);
coordInfoWindow.setPosition(point);
coordInfoWindow.open(map);
BGImageController.fadeBG(false)
},
resizeMap = function () {
$mapEl.css({
width: $(window).width() + 'px',
height: $(window).height() + 'px'
})
},
hideMap = function () {
display = false;
$mapEl.empty()
},
active = function () {
return display
};
return {
showMap: showMap,
hideMap: hideMap,
active: active,
resizeMap: resizeMap
}
})
Última edición por vitimgm01; 11/02/2012 a las 07:47 |