So my problem is that i get only the last popup message from my json file. My marker builder works nice. Any thoughts will be helpful guys. Here is my code:

      function airports() {
                pointsmarks = new OpenLayers.Layer.Markers("Airports");
                $.getJSON('../json/airports.json', function (data) {
                    $.each(data, function () {

                        px = this.FIELD7;
                        py = this.FIELD8;
                        size = new OpenLayers.Size(30, 30);
                        offset = new OpenLayers.Pixel(-(size.w / 2), -(size.h / 2));
                        airicon = new OpenLayers.Icon('../icons/airportsvg.png', size, offset);
                        pointsmarks.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(py, px), airicon));

                       pointsmarks.events.register('mouseover', pointsmarks, function(evt) {                  
                        popup = new OpenLayers.Popup.FramedCloud("Popup",            
                        (new OpenLayers.LonLat(py, px)), null, '<div>'+name+'</div>', null, false);          
                         pointsmarks.events.register('mouseout', pointsmarks,                       
                          setTimeout( function(evt) { popup.destroy(); }, 4000));           

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.