-1

I am using google map on my site and here is google map code:

<script src='https://maps.googleapis.com/maps/api/js?v=3.exp'></script>
<div style='overflow:hidden;height:440px;width:700px;'>
    <div id='gmap_canvas' style='height:440px;width:700px;'></div>
    <style>
        #gmap_canvas img {
            max-width: none!important;
            background: none!important
        }
    </style>
</div>
<script type='text/javascript'>
    function init_map() {
        var myOptions = {
            zoom: 10,
            center: new google.maps.LatLng(51.5073509, -0.12775829999998223),
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        map = new google.maps.Map(document.getElementById('gmap_canvas'), myOptions);
        marker = new google.maps.Marker({
            map: map,
            position: new google.maps.LatLng(51.5073509, -0.12775829999998223)
        });
        infowindow = new google.maps.InfoWindow({
            content: '<strong>Title</strong><br>London, United Kingdom<br>'
        });
        google.maps.event.addListener(marker, 'click', function() {
            infowindow.open(map, marker);
        });
        infowindow.open(map, marker);
    }
    google.maps.event.addDomListener(window, 'load', init_map);
</script>

and getting this map output:

enter image description here

Currently, I have a div which highlight in Red color and marker is displaying beside Red area so I want to move to the left side.

Now I want to move marker on left side and don't want to use center position because I am showing contents on red area on below example:

enter image description here

Any idea how to move the marker on the top left side?

Thanks.

Mr.Happy
  • 2,639
  • 9
  • 40
  • 73
  • possible duplicate of [How to offset the center of a Google maps (API v3) in pixels?](http://stackoverflow.com/questions/3473367/how-to-offset-the-center-of-a-google-maps-api-v3-in-pixels) – geocodezip Jul 11 '16 at 12:57
  • possible duplicate of [How to offset the center point in Google maps api V3](http://stackoverflow.com/questions/10656743/how-to-offset-the-center-point-in-google-maps-api-v3) – geocodezip Jul 11 '16 at 12:58

2 Answers2

0

You can easly shift the map assigning a new center .. (the new coord are for sample)

var newCenter = new google.maps.LatLng(50.5073509, 0.1200)

 map.setCenter(newCenter);
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
0

You can change the the marker by javascript function

function changeMarkerPosition(marker) {
var latlng = new google.maps.LatLng(-24.397, 140.644);
marker.setPosition(latlng);

}

For more information See this link