google maps
HTML
<script src="https://maps.googleapis.com/maps/api/js?v=3"></script>
<script src="https://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/src/infobubble.js"></script>
<div id="map_canvas"></div>
CSS
html, body, #map_canvas {
width:100%;
height:100%;
}
JavaScript
// variable definitions
var center, mapOptions, map, marker, infobubble;
// Initial position of the map
center = new google.maps.LatLng(51.508742, -0.120850);
function initialize() {
// Map options
mapOptions = {
zoom: 5,
center: center,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
// Attach the map to the document
map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
// The marker details
marker = new google.maps.Marker({
position: new google.maps.LatLng(51.508742, -0.120850),
map: map,
title: 'marker7'
});
// define infobubble options
infobubble = new InfoBubble({
maxWidth: 250,
minWidth: 250,
maxHeight: 100,
minHeight: 100,
backgroundColor: 'rgba(65,65,65,0.7)',
disableAnimation: true,
content: '<div><a class="dialog" href="https://maps.google.com/" target="_blank"></a></div>',
});
google.maps.event.addListener(marker, 'click', function () {
infobubble.open(map, marker);
google.maps.event.addListener(infobubble, 'domready', function () {
$(".dialog").html('<img id="theImg" src="https://goo.gl/phmzis" />');
});
});
}
google.maps.event.addDomListener(window, 'load', initialize);