Да.Это дубликат API Карт Google v3: окно InfoWindow неправильно настроено . Однако , ни одно из решений, предложенных по этому вопросу, не сработало для меня :(код:
//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);
Это HTML-код, созданный Google Maps для информационного окна в верхней части карты:
<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>
Хм, помогите?
ПРИМЕЧАНИЕ : у div #locationMap есть стили для его размера (не включены в пример кода).Нет проблем в представлении карты - только представление InfoWindow, которое всегда имеет ширину 247 пикселей, независимо от того, какое значение я установил для его ...