-1
我有一個網站,我加載和使用kmz文件。我的問題是,GEO的位置不工作,我的意思是它的工作,但它不顯示街道因爲JavaScript加載kmz文件,並把重點放在KMZ地圖上,而不是你的GEOlocation。Gmaps搜索和kmz加載javascript
總之,這裏是代碼,所以你可以看看什麼是錯的:
<script type="text/javascript">
var map, infoWindow;
$(document).ready(function(){
infoWindow = new google.maps.InfoWindow({});
map = new GMaps({
el: '#map',
zoom: 20,
lat: 46.044414,
lng: 14.508105,
});
map.loadFromKML({
url: 'http://blabla.com/blabla.kmz',
url: 'http://blabla.com/blabla2.kmz',
suppressInfoWindows: true,
events: {
click: function(point){
infoWindow.setContent(point.featureData.infoWindowHtml);
infoWindow.setPosition(point.latLng);
infoWindow.open(map.map);
}
}
});
});
</script>
<script type="text/javascript">
GMaps.geolocate({
success: function(position) {
map.setCenter(position.coords.latitude, position.coords.longitude);
},
error: function(error) {
alert('Geolocation failed: '+error.message);
},
not_supported: function() {
alert("Your browser does not support geolocation");
},
always: function() {
alert("Success!");
}
});
</script>
哦,我差點忘了,我使用Gmaps.js
非常感謝您先生:D您保存了一天:) – gasperko