Google maps 谷歌地图如何用地图的横向、纵向和纵向动态更新url?
在这里如何做到这一点: 每次我们在地图上移动和缩放时,url都会动态更新Google maps 谷歌地图如何用地图的横向、纵向和纵向动态更新url?,google-maps,Google Maps,在这里如何做到这一点: 每次我们在地图上移动和缩放时,url都会动态更新 感谢这并不困难,请观察地图的bounds\u changed-事件,并在触发时检索地图属性并将其分配给location对象的哈希属性: google.maps.event.addListener(map, 'bounds_changed',function(){ location.hash='lat='+this.getCenter().lat().toFixed(6)+
感谢这并不困难,请观察地图的
bounds\u changed
-事件,并在触发时检索地图属性并将其分配给location对象的哈希属性:
google.maps.event.addListener(map, 'bounds_changed',function(){
location.hash='lat='+this.getCenter().lat().toFixed(6)+
'&lng='+this.getCenter().lng().toFixed(6)+
'&zoom='+this.getZoom();
});
好极了就这样!永远的感激:)