考虑以下代码:
$('.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')));
});
根据文档 https://developers.google.com/maps/documentation/javascript/reference#LatLng,我可以使用setCenter
方法并轻松地将地图居中,但我不明白文档使用的符号。
See:
LatLng(lat:number, lng:number, noWrap?:boolean)
我到底该如何使用这个?
我收到错误:
Uncaught ReferenceError: LatLng is not defined
你必须使用
themap.setCenter(new google.maps.LatLng($(this).data('latitude'), $(this).data('longitude')));
所有 Google 地图 javascript 类均通过google.maps.ClassName()
符号
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)