快速和骯髒的
var infowindow = new google.maps.InfoWindow({
content: '<div id="iw_content"><a href="/" style="color:#f00">3434</a> <a href="/" style="color:#00f">4</a> <a href="/" style="color:#0f0">18-9</a></div>'
});
google.maps.event.addListener(infowindow,'domready',function(){
var el = document.getElementById('iw_content');
//* Get and set a class for the main content containers container
el = el.parentNode.parentNode;
el.setAttribute('class','iw_content_container_container');
//* Get and set a class for the div containing the close window image
closeEl = (el.previousElementSibling)?el.previousElementSibling:el.previousSibling;
closeEl.setAttribute('class','closeInfoWindow');
//* Get and set a class for the div containing the close and main content
el = el.parentNode;
el.setAttribute('class','closeInfoWindowContainer');
//* Get and hide the troublesome background
el = (el.previousElementSibling)?el.previousElementSibling:el.previousSibling;
el.style.display = "none";
//* Get and hide the top image of the arrow
el = (el.previousElementSibling)?el.previousElementSibling:el.previousSibling;
el.style.display = 'none';
//* Get and hide the shadow (hiding commented out for now as not strictly requested)
el = el.parentNode.parentNode;
el = (el.previousElementSibling)?el.previousElementSibling.previousElementSibling:el.previousSibling.previousSibling;
//el.style.display = 'none';
});
這可能爲你工作,以把一些鉤子的代碼,然後你可以用CSS
#iw_content{background:#fff}
.iw_content_container_container{height:auto!important;text-align:center}
.closeInfoWindow {top:22px!important;right:22px!important}
.closeInfoWindowContainer{position:absolute;top:52px;height:auto!important}
您可能要惹解決與.closeInfoWindowContainer頂級值有關,因爲這取決於文本數量。基本上只用你的一條線進行測試。
我試着實際刪除代碼本身的寬度和高度(所以在javascript中添加/更改),但Maps在加載時會根據遊標的狀態和位置將它們重新放回。
...
信息窗口是可點擊的。它們只是頁面中的普通div元素,可以這樣對待。我在示例超鏈接中創建了各種值來顯示它。
對不起,這不是wicketstuff,但我想我應該仍然發佈解決方案。
非常感謝!我會嘗試採用這種解決方案。 – cynepnaxa 2013-02-27 05:32:21