Hi to all, I have a map with a lot of marker. Every marker is added by the
function at the bottom. All works very well and i can see all marker in the
map with its popup if i click on it. Now I would create a popup window with
an html list of all markers in the map and if i click an item i want the
marker associated in the map opens its popup.
I've looked in the example, but i can't find the solution. Is there a way to
do what i need?

Thank you very much for your help!

function addMarker(ll, popupClass, popupContentHTML, closeBox, overflow,
iconID) {        
                                
                                var size = "";
                                var offset = "";
                                var icon = "";
                                switch (iconID)
                                {                               
                                        case 1:
                                        {
                                                size = new 
OpenLayers.Size(17,29);
                                offset = new OpenLayers.Pixel(-(size.w/2), 
-size.h);                            
                                                icon = new
OpenLayers.Icon(\'./templates/images/GREEN.png\',size,offset);
                                        }break;                         
                                        case 2:
                                        {
                                                size = new OpenLayers.Size(8,8);
                                offset = new OpenLayers.Pixel(-(size.w/2), 
-size.h);                            
                                                icon = new
OpenLayers.Icon(\'./templates/images/listitem.png\',size,offset);
                                        }break;
                                        case 3:
                                        {
                                                size = new 
OpenLayers.Size(17,29);
                                offset = new OpenLayers.Pixel(-(size.w/2), 
-size.h);                            
                                                icon = new
OpenLayers.Icon(\'./templates/images/RED.png\',size,offset);
                                        }break;
                                        default:
                                        {
                                                size = new 
OpenLayers.Size(17,29);
                                offset = new OpenLayers.Pixel(-(size.w/2), 
-size.h);                            
                                                icon = new
OpenLayers.Icon(\'./templates/images/AQUA.png\',size,offset);
                                        }break;
                                }
                                                                        
                                
                                var feature = new OpenLayers.Feature(markers, 
ll, {icon: icon});                                        
                                
                feature.closeBox = closeBox;
                    feature.popupClass = popupClass;
                    feature.data.popupContentHTML = popupContentHTML;
                    feature.data.overflow = (overflow) ? "auto" : "hidden";     
                
                    
                var marker = feature.createMarker();                            

                    var markerClick = function (evt) {
                    if (this.popup == null) {
                            this.popup = this.createPopup(this.closeBox);
                                map.addPopup(this.popup);
                                this.popup.show();
                        } else {
                        this.popup.toggle();
                        }
                         currentPopup = this.popup;
                    OpenLayers.Event.stop(evt);
                };
                    marker.events.register("mousedown", feature, markerClick);  
                                

                markers.addMarker(marker);                              

                }
-- 
View this message in context: 
http://n2.nabble.com/open-popup-in-open-layers-from-external-list-tp1298733p1298733.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to