How to center the Google Map NOT at the center of the screen?

北慕城南 提交于 2019-12-02 02:19:53

You may first center the map at the given LatLng and then use panBy() to apply the offset:

 map.panBy(-Math.floor(map.getDiv().offsetWidth/6),0)

For gmap3 you may use the event-property of the map-option to apply it: add the following code

        events:{
        idle:function(map){
            google.maps.event.clearListeners(map,'idle');
            map.panBy(-parseInt(this.width()/6),0);
         }
      },

right after

$et_main_map.gmap3({
        map:{
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!