【问题标题】:WpCasa Map, avoid fitBounds() Zoom too close for single markerWpCasa Map,避免 fitBounds() 对单个标记缩放太近
【发布时间】:2018-04-20 14:30:21
【问题描述】:

看着这个问题Google Maps v3 fitBounds() Zoom too close for single marker

似乎最简单的方法是通过 maxZoom 选项

var map = new google.maps.Map(document.getElementById("map"), { maxZoom: 14 });

查看插件的源代码,似乎有一个钩子wpsight_listings_map_options

现在我对如何使用钩子感到困惑。

【问题讨论】:

    标签: wordpress


    【解决方案1】:

    事实证明我找到了自己的方式......也许它可以帮助其他人。

    这是我添加到functions.php的内容

    add_filter( 'wpsight_listings_map_options', 'wpsight_listings_maxZoom' );
    function wpsight_listings_maxZoom( $opt ) { 
    
      $opt['map']['maxZoom'] = 16;
    
      return $opt;
    
    }
    

    【讨论】:

      猜你喜欢
      • 2011-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-22
      • 2012-03-20
      相关资源
      最近更新 更多