Created
January 12, 2016 14:01
-
-
Save th0mk/6af32b27a9853ff12aa9 to your computer and use it in GitHub Desktop.
JS code required for google_map.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function (){ | |
// create a LatLng object containing the coordinate for the center of the map | |
var latlng = new google.maps.LatLng(53.3, 6.0); | |
// prepare the map properties | |
var options = { | |
zoom: 13, | |
center: latlng, | |
mapTypeId: google.maps.MapTypeId.ROADMAP, | |
navigationControl: true, | |
mapTypeControl: false, | |
scrollwheel: false, | |
disableDoubleClickZoom: true | |
}; | |
// initialize the map object | |
var map = new google.maps.Map(document.getElementById('google_map'), options); | |
// add a marker | |
var marker1 = new google.maps.Marker({ | |
position: latlng, map: map | |
}); | |
// add listener for a click on the pin | |
google.maps.event.addListener(marker1, 'click', function() { | |
infowindow.open(map, marker1); | |
}); | |
// add information window | |
var infowindow = new google.maps.InfoWindow({ | |
content: '<div class="info"><strong>Hier is het bedrijf</strong><br>subtekst</div>' | |
}); | |
}); | |
//Use a div with the ID google_map | |
<div id="google_map"></div> | |
//CSS for div (required for it to show) | |
#google_map { | |
height: 300px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment