ser*_*erg 3 javascript api google-maps
请考虑以下代码:
$('.stores').click(function() {
console.log($(this).data('latitude')); // -1754.26265626
console.log($(this).data('longitude')); // 65.262518
console.log(themap); // Properly a Google Map instance.
themap.setCenter(new LatLng($(this).data('latitude'), $(this).data('longitude')));
});
Run Code Online (Sandbox Code Playgroud)
根据文档,我可以使用该setCenter方法并轻松地使地图居中,但我不理解文档正在使用的符号.
看到:
LatLng(lat:number, lng:number, noWrap?:boolean)
Run Code Online (Sandbox Code Playgroud)
我究竟如何使用它?
我收到错误:
Uncaught ReferenceError: LatLng is not defined
Run Code Online (Sandbox Code Playgroud)
你必须使用
themap.setCenter(new google.maps.LatLng($(this).data('latitude'), $(this).data('longitude')));
Run Code Online (Sandbox Code Playgroud)
所有Google Maps javascript类都使用google.maps.ClassName()符号引用
| 归档时间: |
|
| 查看次数: |
12666 次 |
| 最近记录: |