Google maps API v3 example
Based on examples found here: https://developers.google.com/maps/documentation/javascript/examples/
<html>
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
body, #map-wrapper {
position: relative;
padding: 0;
margin: 0;
}
#map-wrapper,
#map-canvas {
height: 175px;
width: 315px;
}
#map-canvas {
padding: 0px;
background-color: #cccccc;
}
#large-map {
position: absolute;
top: 5px;
right: 105px;
text-align: center;
font-family: Roboto, Arial, sans-serif;
padding: 1px 6px;
border-radius: 2px;
border: 1px solid rgba(0, 0, 0, 0.14902);
-webkit-box-shadow: rgba(0, 0, 0, 0.298039) 0px 1px 4px -1px;
box-shadow: rgba(0, 0, 0, 0.298039) 0px 1px 4px -1px;
min-width: 29px; font-weight: 500;
background-color: rgb(255, 255, 255);
background-clip: padding-box;
}
#large-map a {
font-size: 11px;
color: #000000;
text-decoration: none;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script>
function initialize() {
var map;
var alsLat = 65.6166587;
var alsLng = 22.1258089;
var alsTitle = 'ALS Scandinavia, Luleå';
var alsAddress = 'Aurorum 10';
var alsPhone = 'Tel: 0920-28 99 00';
var alsLatLng = new google.maps.LatLng(alsLat,alsLng);
var mapOptions = {
zoom: 15,
center: new google.maps.LatLng(alsLat,alsLng)
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
var image = 'static/img/logo-xs.png';
var beachMarker = new google.maps.Marker({
position: alsLatLng,
map: map,
icon: image
});
var contentString = '<div id="content">'+
'<b>'+ alsTitle +'</b><br>'+
alsAddress + '<br>'+
alsPhone + '<br>' +
alsLatLng +
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
google.maps.event.addListener(beachMarker, 'click', function() {
infowindow.open(map, beachMarker);
});
}
//$( document ).ready(function() {
// $( "#map-canvas" ).bind( "click", function() {
// initialize();
// $( "#map-canvas").unbind( "click" );
// });
//});
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-wrapper">
<div id="map-canvas"></div>
<div id="large-map"><a href="https://www.google.se/maps/place/AURORUM+10,+977+75+Luleå">Large map</a></div>
</div>
</body>
</html>Knowledge keywords:
