2013-02-25 46 views
0

我寫的頁面顯示了舊貨品的賣家。地圖上有許多短信息元素,包括價格,物品狀態和賣家可用時間。我想減少信息窗口的空閒空間,以便更多的信息窗口適合屏幕。我在檢票東西gmap3的6.5.0嘗試新功能 - 「內幕信息窗口面板」,但沒有運氣 - 圖爲CSS的結果是:如何減少wicket-stuff gmap3庫中的信息窗口大小?

border : 1px solid black ; 
margin : 0; 
padding : 0; 

我怎樣才能最大限度地減少winfo窗口,並配合信息的自由空間它的內容?

P.S.這將是最好的,如果我可以用指針做可點擊的數字組。但信息窗口不可點擊,所以有標記。想法 - 用戶首先根據信息窗口中顯示的主要屬性進行育種選擇,然後單擊他的選擇並在頁面上的其他位置顯示完整的信息。

P.P.S.嗯,我現在還有一個想法 - 我不需要帶狀態的數字。我只是可以用不同的顏色來繪製信息(綠色=「像新的」,藍色=「使用硬,但作品」,紅色=「垃圾」):)。

enter image description here

回答

1

快速和骯髒的

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,但我想我應該仍然發佈解決方案。

+0

非常感謝!我會嘗試採用這種解決方案。 – cynepnaxa 2013-02-27 05:32:21