2017-10-16 21 views
-1

Googleマップをサイト内に初めて埋め込むようにしていますが、表示することができません。誰でもコード内の欠陥を見ることができます。ありがとうございました;Googleマップを埋め込む

$(document).ready(function(){ 
function initMap() { 
var location = {lat: 51.594808, lng: 0.084447}; 
var map = new google.maps.Map(document.getElementById("map"),{ 
zoom: 4, 
center: location 
}); 
var marker = new google.maps.Marker({ 
position: location, 
map: map 
}); 
} 
async defer src="https://maps.googleapis.com/maps/api/js…" 
}); 

答えて

0
<script src="https://maps.googleapis.com/maps/api/js?region=SA&v=3.exp"> 
</script> 
<script> 
$(document).ready(function(){ 

initMap(); 
}); 

function initMap() { 
var location = {lat: 51.594808, lng: 0.084447}; 
var map = new google.maps.Map(document.getElementById("map"),{ 
zoom: 4, 
center: location 
}); 
var marker = new google.maps.Marker({ 
position: location, 
map: map 
}); 
} 
</script> 
+0

すごいああ!それは地図がポップアップしたときにエキサイティングでした!ありがとう、カッセム。 なぜ外部jsファイルで動作していないのでしょうか? – Alex

+0

また、ページをリフレッシュするたびに地図が消えてしまい、コードをカットアンドペーストしなければなりません。非常に奇妙です! – Alex

関連する問題