Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当我使用Openlayers打开Jquery Mobile弹出窗口时,如何使其位于标记上方?_Jquery_Jquery Mobile_Openlayers - Fatal编程技术网

当我使用Openlayers打开Jquery Mobile弹出窗口时,如何使其位于标记上方?

当我使用Openlayers打开Jquery Mobile弹出窗口时,如何使其位于标记上方?,jquery,jquery-mobile,openlayers,Jquery,Jquery Mobile,Openlayers,下面是我的代码。我清理并修改了addMarkers函数,所以我知道它在本例中不起作用,但我只是想缩短它,以显示我在做什么 我很难弄清楚如何设置弹出窗口的位置。我以为positionto:event.target可以工作,但它不会在target中返回任何内容。有什么想法吗?我希望它像大多数项目一样弹出,当你点击地图上的一个标记 function addMarkers(json){ for (var i=0;i<json.records.record.length;i++){

下面是我的代码。我清理并修改了addMarkers函数,所以我知道它在本例中不起作用,但我只是想缩短它,以显示我在做什么

我很难弄清楚如何设置弹出窗口的位置。我以为positionto:event.target可以工作,但它不会在target中返回任何内容。有什么想法吗?我希望它像大多数项目一样弹出,当你点击地图上的一个标记

 function addMarkers(json){
        for (var i=0;i<json.records.record.length;i++){

            // Make Point
            point = new OpenLayers.Geometry.Point(lonLat.lon, lonLat.lat);
            feature = new OpenLayers.Feature.Vector(point);
            layer.addFeatures(feature);
        }
        map.addLayer(layer[0]);
    }
}


var selectControl = new OpenLayers.Control.SelectFeature(
    [vectorlayer1, vectorlayer2],
    {
        clickout: true, toggle: false,
        multiple: false, hover: false
    }
);

vectorlayer1.events.on({
    "featureselected": popup,
    "featureunselected": function(e) {
        alert("unselected feature "+e.feature.id+" on vectorlayer 1");
    }
});

 function popup(event){
    $("#popup").popup('open', {
        positionTo: event.target
    });
}
函数addMarkers(json){
对于(var i=0;iFrom:
“positionTo”参数必须是字符串(“原点”或“窗口”)或JQuery选择器。
在这种情况下,$(event.target)将起作用