如何检测到用户已将Google地图从地图更改为卫星

时间:2020-08-30 07:53:47

标签: javascript google-maps google-maps-api-3

我需要检测用户何时将地图从“ 地图”更改为“ 卫星”,反之亦然。 'zoom_changed'有一个活动
我试图找到一个类似的事件来更改视图类型。

在堆栈上有一些建议可以使用zoom_changed起作用,但是我已经对其进行了测试,并且在更改地图类型时不会触发。

1 个答案:

答案 0 :(得分:1)

还有一个名为的事件: <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" /> <table class="table table-bordered" style="table-layout: fixed;"> <thead class="thead-dark"> <tr> <th scope="col">Year</th> <th scope="col">Month</th> <th scope="col">Savings</th> <th scope="col">Savings for holiday!</th> <th scope="col">Random Words</th> </tr> </thead> <tbody> <tr id='haha'> <td rowspan="2">2020</td> <td rowspan="2">January</td> <td rowspan="2">text in here should be long enough to take more than 1 row</td> <td>$100</td> <td>Hello</td> </tr> <tr> <td>$200</td> <td>There</td> </tr> </tbody> </table>

有关更多信息,请查看jsfiddle和属性Google Maps Documentation MaptypeId Changed Event