Skip to content

Instantly share code, notes, and snippets.

@enlacee
Created February 22, 2013 23:38
Show Gist options
  • Save enlacee/5017441 to your computer and use it in GitHub Desktop.
Save enlacee/5017441 to your computer and use it in GitHub Desktop.
mapa full event click == una function anonima compleja. windows.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1. Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv='Content-type' content='text/html;charset=UTF-8' />
<title>Freeway</title>
<!-- SCRIPT MAPA -->
<style type="text/css">
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="https://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
function initialize() {
var latTotal = new google.maps.LatLng(42.6847550, -73.85430040);
var myOptions = {
zoom : 7,
center: latTotal,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
var infowindow = new google.maps.InfoWindow({
content: ''
});
var marcadores = [
{
positionMarcadores:{
lat : 42.6847550,
lng : -73.79601599999999
},
contenido: "Description1"
},
{
positionMarcadores:{
lat : 42.99951260,
lng : -73.85430040
},
contenido: "<strong>Description2</strong>"
}
];
for (var i = 0, j = marcadores.length; i < j; i++) {
var description = marcadores[i].contenido;
var marker = new google.maps.Marker({
position: new google.maps.LatLng(marcadores[i].positionMarcadores.lat, marcadores[i].positionMarcadores.lng),
map: map
});
(function(marker, description){
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(description);
infowindow.open(map, marker);
});
})(marker,description);
}
}
function zom(lat,lgt,description){
var latlng = new google.maps.LatLng(lat,lgt);
var myOptions = {
zoom: 7,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
var infowindow = new google.maps.InfoWindow({
content: description
});
marker = new google.maps.Marker({
map:map,
draggable:true,
animation: google.maps.Animation.DROP,
position: latlng
});
google.maps.event.addListener(marker, 'click', function(){
infowindow.open(map,marker);
});
}
</script>
<!-- FIN SCRIPT MAPA -->
</head>
<body id="page" onload="initialize()">
<!-- AQUI VA EL MAPITA -->
<table width="630" border="0">
<tr>
<td width="630">
<div id="map_canvas" style="width:602px; height:280px"></div>
</td>
</tr>
<tr>
<td width="630">
<ul id="direcciones">
<li>
<p> <b> ALBANY</b></p><p><b>1020 Central Avenue Albany, NY 12205 </b> </p>
<p>Phone: 518-489-7405</p>
<p>Fax: 518-489-8381</p>
<p>Hours: 8:30 AM - 5:00 PM/ Thu 8:30AM&ndash;6:00PM </p><p> Saturday 10:00 AM &ndash; 1:00 PM</p>
<a href="javascript:zom(42.6847550,-73.79601599999999, 'descriptionnn' )">Zoom</a>
</li>
</ul>
</td>
</tr>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment