javascript - How to change marker postion on Google Map API -
i using google map on site , here 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 map output:
currently, have div highlight in red color , marker displaying beside red area want move left side.
now want move marker on left side , don't want use center position because showing contents on red area on below example:
any idea how move marker on top left side?
thanks.
you can easly shift map assigning new center .. (the new coord sample)
var newcenter = new google.maps.latlng(50.5073509, 0.1200)   map.setcenter(newcenter);      

Comments
Post a Comment