예. 이것은 Google Maps API v3: InfoWindow not sizing correctly의 복제본입니다.
그러나, 그 질문에 제공되는 솔루션 중 누구도 나를 :(위해 일하지 코드
: 이것은 HTML Google지도는자바 스크립트로 Google Maps InfoWindow의 크기를 조절하는 방법 (v3 API)
//after getting a 'position' object:
var mapPos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
var mapOptions = { zoom:16, center:mapPos,mapTypeId:google.maps.MapTypeId.ROADMAP };
var yourLocationMap = new google.maps.Map(document.getElementById('locationMap'), mapOptions);
var infoContent = '<div style="width:40px;height:20px;">some information content...</div>';
var infoBaloon = new google.maps.InfoWindow({position:mapPos, content:infoContent, maxWidth:40});
infoBaloon.open(yourLocationMap);
지도의 상단에있는 정보 - 윈도우 생성 :
<div style="width: 247px; height: 88px;"> //<-This is actually the size of the info
window. I have no idea on what basis it decides on these dimensions.
//next is the div for the 'X'(close) button:
<div style="width: 10px; height: 10px; overflow: hidden; position: absolute; opacity: 0.7; left: 12px; top: 12px; z-index: 10000; cursor: pointer;">
<img src="http://maps.gstatic.com/mapfiles/mv/imgs8.png" style="position: absolute; left: -18px; top: -44px; width: 68px; height: 67px; -moz-user-select: none; border: 0px none; padding: 0px; margin: 0px;"></div><div style="cursor: default; position: absolute; right: 18px; top: 18px; z-index: 2; overflow: auto; width: 213px; height: 54px;">
</div>
// I don't know where this div is coming from... :\
<div style="cursor: default; position: absolute; right: 18px; top: 18px; z-index: 2; overflow: auto; width: 213px; height: 54px;">
<div style="overflow: auto;">
**// and then, finally, the div I put in the Content of the InfoWindow:
<div style="width:40px;height:20px;">Some content information...</div>**
</div>
</div>
</div>
음은
참고 : #locationMap div에는 크기에 대한 스타일이 있습니다 (코드 예제에는 포함되지 않음). 지도의 표현에는 아무런 문제가 없습니다. InfoWindow의 표현은 그 내용을 무엇으로할지에 관계없이 항상 247px로 보이는 것입니다 ...
정보창의 최소 너비가 247px 일 수 있습니까? 내가 찾은 유일한 종류의 "증거"는이 기사에 있습니다. http://www.svennerberg.com/2009/02/working-with-info-windows-in-google-maps/ –
위의 질문 솔루션은 Google지도 v2에서만 사용하기 때문에 작동하지 않습니다. jQuery를 사용하여 HTML을 해킹하여 infowindow 크기를 동적으로 업데이트했습니다.하지만 코드 수정과 같은 것 같습니다. 그래서 더 나은 것은 이것에 집중하지 말고 가능한 경우 기능 (표현)을 변경하는 것입니다. – Jaykishan