I'm trying to center the map around the marker, right now you can barely see the marker in the left corner.
My code is:
<script>
function initialize() {
var myLatlng = new google.maps.LatLng(<?php echo $hotelInformation['latitude']?>, <?php echo $hotelInformation['longitude']?>);
var mapCanvas = document.getElementById('map-canvas');
var mapOptions = {
center: myLatlng,
zoom: 12,
}
var map = new google.maps.Map(mapCanvas, mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title:"<?php echo $hotelInformation['name']?>"
});
var latLng = marker.getPosition();
map.setCenter(latLng);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
Have tried in multiple ways to get it to center but it doesen't work out How do I center the map so the marker is in the middle?