我有功能ID,我可以抓住GeoRSS流派上的標記圖層,但我仍然不確定如何導致彈出窗口以編程方式顯示。在OpenLayers(OSM)中觸發一個功能的彈出窗口的正確方法是什麼?
如果需要的話,我會根據需要創建彈出窗口,但好像我應該能夠獲取地圖上繪製的標記的ID並在其上調用某個事件。我嘗試過使用jQuery並在地圖元素上調用$(marker-id).click()
事件,但這似乎不起作用。我錯過了什麼?
自從我要求的代碼,因爲我認爲它是樣板,這裏的地方我至今:
map = new OpenLayers.Map('myMap');
map.addLayer(new OpenLayers.Layer.OSM());
map.addLayer(new OpenLayers.Layer.GeoRSS(name,url));
//I've done some stuff as well in re: projections and centering and
//setting extents, but those really don't pertain to this question.
在其他地方我已經做了一些jQuery的模板和我建了一個漂亮的列表所有在地圖上顯示的點數。我知道如何從圖層loadend
進行回調並獲取圖層對象,我知道如何手動從地圖中檢索圖層,我知道如何通過圖層集合找到我的圖層。因此,我可以獲取有關彈出窗口的任何詳細信息,但我仍然不知道如何使用DOM或此API的內置方法使其像element.click()
那樣簡單,這是我更喜歡的方式做。
當一個彈出添加到彈出的圖層,其自動打開。你可以發佈你的開發的一些源代碼嗎? – 2011-03-31 12:53:56
@Fran〜我正在添加一個georss圖層,我只是想能夠製作一些類似google的地圖頁面,點擊左側的鏈接會使彈出窗口顯示在右側。我真的不認爲我的任何代碼都意味着什麼。這是在字面上建立東西在左側顯示,然後對於地圖它是'map = new OpenLayers.Map('myMap'); map.addLayer(new OpenLayers.Layer.OSM()); map.addLayer(新的OpenLayers.Layer.GeoRSS(name,url));'我寫的任何其他代碼都不會涉及到手頭的問題,我敢肯定。 – jcolebrand 2011-03-31 14:52:14
你是否有足夠的能力來解決這個問題? – 2011-04-18 13:56:43