<!-- JavaScript for Google Maps -->
<script src="https://maps.googleapis.com/maps/api/js"></script>
<script>
function initialize(){
var myLatLng = new google.maps.LatLng(47.702951, -122.277713);
var mapOptions = {
zoom: 15,
center: myLatLng
}
var mapCanvas = document.getElementById('map-canvas');
var map = new google.maps.Map(mapCanvas, mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!'
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
you can see that your code isn’t all that different
function initialize() {
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var mapOptions = {
zoom: 4,
center: myLatlng
}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!'
});
}
google.maps.event.addDomListener(window, 'load', initialize);
Exceptions being that LatLng () is assigned to a variable so that it can be reused without needing to do the whole bit again every place it’s used (granted, only two places here, but a good habit to get into). And it has
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!'
});
Inside initialize() just before the closing curly brace
So now that I have a map of the neighborhood where my client’s shop is, and there is a balloon to show his address, what else can I do to provide value to people visiting his website?
Earlier someone said that if you click on the balloon it should give you a prompt to enter your address so you can get directions to his shop.