Below is my code for when I hover over a specific layer and the popup hotspot 
information is shown. I am trying to figure out how to only get one popup to 
show at a time so that I can show them like tooltips and destroy the existing 
one if another is shown. I have tried using if (infopop) or if (!infopop) but 
this doesn't seem to work in the way I have this coded. If anyone has any 
advice on how to destroy my popup when another is created thanks!






var info, infopop;

         //Getfeatureinfo object
         info = new OpenLayers.Control.WMSGetFeatureInfo({
                         url: 'http://ITS701X5J1/RedWMS/Request.aspx',
            title: 'Identify features by clicking',
            layers: [layer_Garbage_Zones],
            queryVisible: true,
            infoFormat: 'text/html',
            maxFeatures: 1,
            hover:true
            });

            info.events.on({
              getfeatureinfo: function(e) {

             infopop =  new GeoExt.Popup({      //utilizing the GeoExt popup 
functionality
                   title: "Hotspot Information",
                    //height: 215,
                    //width: 600,
                                        autoWidth: true,
                                        autoHeight: true,
                                        autoScroll: false,
                  //  panIn: true,
                    map: map,
                    lonlat: map.getLonLatFromPixel(e.xy),
                    html: e.text
                })

                    etext = e.text;
                       // if the hotspot information is empty (layer doesn't 
match) don't display!
               if (etext.length == 45)
                    {
                            infopop.close();
                    }
                    else
                    {
                        infopop.show();
                    }
                }});


         map.addControl(info);
     info.activate();





_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to