0
林需要两件事情更新实时谷歌地图
1)实时更新,无需刷新页面 2)上的标记的标签,以确定谁是其中。
这部分代码我碰到这确实位置标记来对通过JS地图,但没有刷新没有实时更新..
<html>
<head>
<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<style>
#map-canvas
{
height: 400px;
width: 500px;
}
</style>
</head>
<body>
<div id="map-canvas"></div>
<script>
var myLatLng = new google.maps.LatLng(54.0239304,-1.5453314000000091),
myOptions = {
zoom: 4,
center: myLatLng,
mapTypeId: google.maps.MapTypeId.ROADMAP
},
map = new google.maps.Map(document.getElementById('map-canvas'), myOptions),
marker = new google.maps.Marker({position: myLatLng, map: map});
marker.setMap(map);
setTimeout(function(){
marker.setPosition(new google.maps.LatLng(54.0239304,-1.5453314000000091));
map.panTo(new google.maps.LatLng(54.0239304,-1.5453314000000091));
}, 1500);
</script>
</body>
</html>
关于这个问题的任何帮助,将不胜感激。
谢谢你。上面的代码只在刷新时才起作用。 – user7763438