0

永続的なポップアップを作成する必要がありますが、マウスイベントのときにのみ表示することができました.例は見つかりましたが、成果を適応させるものは何もありません:

誰でもポップアップを永続的にするのを手伝ってくれます、ありがとう。

var mapa;
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
OpenLayers.ImgPath = "/openlayers/img/"
mapa = new OpenLayers.Map('map',{
    controls: [
            new OpenLayers.Control.Attribution(),
            new OpenLayers.Control.Navigation(),
            new OpenLayers.Control.PanZoomBar(),
    ],
    theme: null
});
var osm  = new OpenLayers.Layer.OSM( " Open Street Map" );
var markers = new OpenLayers.Layer.Markers( "Ruta" );
$.each(info, function(i, data){
    var size   = new OpenLayers.Size(21,25);
    var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
    var icon   = new OpenLayers.Icon('/openlayers/img/data.png',size,offset);
    var lonlat = new OpenLayers.LonLat(parseFloat(data.long),parseFloat(data.lat));
    var proj_1 = new OpenLayers.Projection("EPSG:4326");
    var proj_2 = new OpenLayers.Projection("EPSG:900913");
    var EPSG   = lonlat.transform(proj_1,proj_2);
    var marker = new OpenLayers.Marker(EPSG, icon);
    markers.addMarker(marker);
    // popup
    marker.events.register("click", marker, function(e){
        var popup = new OpenLayers.Popup.FramedCloud(data.idunidad,
                    marker.lonlat,
                    new OpenLayers.Size(200,200),
                    '<p>info in the popup, mouse event</p>',
                    null,true);
        popup.idunidad = data.idunidad;
        mapa.addPopup(popup);
        arrPopup.push(popup);
    });
});
var lonlat  = new OpenLayers.LonLat(-74.075833,4.598056);
var proj_1  = new OpenLayers.Projection("EPSG:4326");
var proj_2  = new OpenLayers.Projection("EPSG:900913");
var centrar = lonlat.transform(proj_1,proj_2);
mapa.addLayers([osm,markers]);
mapa.setCenter(centrar, 5);
mapa.addControl(new OpenLayers.Control.LayerSwitcher());
4

1 に答える 1