이 페이지의지도를 몇 달 동안 사용해 보았습니다. 이제지도가로드되지만 표시되지 않습니다. 나는 api가 코드를 추가하기 때문에 이것을 말할 수있다. 그러나 최종 결과는지도 div의 공백입니다. 어떤 도움은 긍정적입니다. 아래는 자바 스크립트 및 html 코드입니다.Google지도 Api로드 중이지만 표시되지 않음
/**********************************************************/
/* JS Google Map */
/**********************************************************/
function initMap() {
var myLocation = new google.maps.LatLng(36.828800, -76.132800);
var draggableValue;
if($(document).width() <= 768){
draggableValue = false;
}
else{
draggableValue = true;
}
var mapOptions = {
center: myLocation,
zoom: 16,
mapTypeControl: true,
draggable: draggableValue,
scaleControl: false,
scrollwheel: false,
styles: [
{
"featureType": "landscape",
"stylers": [
{ "visibility": "on" },
{ "color": "#555559" },
{lightness: 51}
]
},{
"featureType": "poi",
"stylers": [
{ "visibility": "off" }
]
},{
"featureType": "road",
"stylers": [
{ "color": "#555559" }
]
},{
"elementType": "geometry.stroke",
"stylers": [
{ "visibility": "off" }
]
},{
"featureType": "road",
"elementType": "labels.text.fill",
"stylers": [
{ "visibility": "on" },
{ "weight": 8 },
{ "hue": "#ffffff" },
{ "color": "#ffffff" }
]
},{
"featureType": "landscape",
"elementType": "labels.text.stroke",
"stylers": [
{ "color": "#ffffff" },
{ "visibility": "on" }
]
},{
"featureType": "poi",
"elementType": "labels.icon",
"stylers": [
{ "visibility": "on" }
]
},{
"featureType": "water",
"elementType": "labels.text.fill",
"stylers": [
{ "visibility": "off" },
{ "color": "#ffffff" }
]
},{
"featureType": "water",
"elementType": "labels.text.stroke",
"stylers": [
{ "visibility": "on" },
{ "color": "#ffffff" }
]
},{
"featureType": "water",
"stylers": [
{ "color": "#555559" },
{lightness: 25}
]
},{
},{"stylers": [{"saturation": 0}]}
],
streetViewControl: true /**/
};
var image = new google.maps.MarkerImage('/assets/images/icon.png',
new google.maps.Size(500, 500),
new google.maps.Point(0, 0),
new google.maps.Point(30, 30),
new google.maps.Size(60, 60)
);
var shape = {
coords: [1, 1, 1, 60, 60, 60, 60, 1],
type: 'poly'
};
var infowindow = new google.maps.InfoWindow({
pixelOffset: new google.maps.Size(0, 30),
content: '<h5 class="map-header text-center">Header</h5><p class="text-center">Info window text</p>'
});
var marker = new google.maps.Marker({
position: myLocation,
icon: image,
anchorPoint: new google.maps.Point(0, -60),
title: 'Header'
});
var map = new google.maps.Map(document.getElementById("map"),
mapOptions);
marker.setMap(map);
marker.addListener('click', function() {
infowindow.open(map, marker);
});
}
google.maps.event.addDomListener(window, 'load', initMap);
/**********************************************************/
/* HTML Google Map */
/**********************************************************/
<section style="height:100%;">
<div class="map" id="map">
</div>
</section>
여기는 jsfiddle입니다.
피들이 올바르게 구성되어 있지 않습니다. (jQuery를 사용하고 있지만 포함시키지 마십시오. 보안 jsfiddle에 비보안 버전의 API를 포함하고 있으며, 코드가 onload를 실행하도록 설정되어 있지만 예상하고 있습니다. 글로벌 네임 스페이스에 있음 ...) – geocodezip
[Issue 10449 : 버그 :지도가 표시되지 않고 콘솔 오류가 없음] (https://code.google.com/p/gmaps-api-issues/issues/)과 관련이 있습니다. 세부 사항? id = 10449) – geocodezip