-1
마커 외부로 정보 창을 이동하고 싶습니다. 이 예제에서 infowindow는 마커의 같은 지점에서 열립니다.이 코드에서 앵커 포인트에 대한 오프셋을 정의 할 수있는 Google지도 API는
마커 외부로 정보 창을 이동하고 싶습니다. 이 예제에서 infowindow는 마커의 같은 지점에서 열립니다.이 코드에서 앵커 포인트에 대한 오프셋을 정의 할 수있는 Google지도 API는
google.maps.Marker은 InfoWindow의 유효한 앵커입니다.
var infoWindow = new google.maps.InfoWindow();
infoWindow.setContent("some content");
infoWindow.open(map,marker);
코드 :
function initialize() {
var map = new google.maps.Map(
document.getElementById("map_canvas"), {
center: new google.maps.LatLng(37.4419, -122.1419),
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var marker = new google.maps.Marker({
position: map.getCenter(),
map: map
});
var infoWindow = new google.maps.InfoWindow();
infoWindow.setContent("some content");
infoWindow.open(map, marker);
}
google.maps.event.addDomListener(window, "load", initialize);
html,
body,
#map_canvas {
height: 100%;
width: 100%;
margin: 0px;
padding: 0px
}
<script src="https://maps.googleapis.com/maps/api/js"></script>
<div id="map_canvas"></div>
해당 정보가 없습니다. – geocodezip
무엇 마커? 게시 된 코드에는 마커가 없습니다. 문제를 나타내는 [mcve]를 제공해주십시오. BTW - [google.maps.Marker] (https://developers.google.com/maps/documentation/javascript/reference#Marker)는 InfoWindow의 올바른 앵커입니다. – geocodezip