WpCasa Map,避免fitBounds()缩放太近以至于单个标记

时间:2017-11-08 02:30:49

标签: wordpress

看看这个问题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

的钩子

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

1 个答案:

答案 0 :(得分:0)

原来我找到了自己的方式......也许它可以帮助别人。

这是我添加到functions.php

的内容
add_filter( 'wpsight_listings_map_options', 'wpsight_listings_maxZoom' );
function wpsight_listings_maxZoom( $opt ) { 

  $opt['map']['maxZoom'] = 16;

  return $opt;

}
相关问题