2010-07-20 84 views
4

我能畫覆蓋項目在谷歌地圖就好了,看起來圖像像:在Google地圖上展開疊加標記?

______ 
| | 
______ 
    \/ 

其中「/」部分是「針」這標誌着經/緯度地圖,並在畫面上它的中間。我的問題是,有什麼方法可以在用戶點擊它時擴展它?當然,我必須將其更改爲某種對話框或佈局,並在點擊時進行更改。

我想擁有它更小的像只當沒有點擊的圖像,但它被點擊時,它在擴展就像第二層到:

-------------------------------------- 
| <image>     <buttons> | 
|       <buttons> | 
| <some info here>     | 
|         | 
-------------------------------------- 
       \/ 

這可能嗎?

+0

你解決了這個問題? – TamiL 2012-11-07 14:46:02

回答

0

創建自定義覆蓋圖,並在onAdd覆蓋中創建具有所需內容佈局的自定義div。

myOverlay.prototype.onAdd = function(){ 
    var div = document.createElement('DIV'); 
    div.style.position = 'absolute'; // so we can position it later. 
    // populate the div 
    this.div_ = div; 
    this.getPanes().overlayLayer.appendChild(div); 
} 

現在在draw覆蓋您決定在何處放置在地圖上。 在繪圖中,您可以最初使用單擊事件處理程序繪製標記,以在div上設置可見性。

myOverlay.prototype.draw = function(){ 
    var div = this.div_; 
    //populate div with content as required. 
    div.style.left = //calculate location based on width/height and centre 
    div.style.top = // ditto 
}