Reputation: 363
Below is my code. I cleaned up and modified the addMarkers function, so i know that it is not going to work in this example but just wanted to shorten it down to show what I was doing.
I am having a hard time figuring out how to set the position of the popup. I thought positionto: event.target would work but it is not coming back with anything in target. Any ideas? I want it to popup like most items do from when you click on a marker on a map.
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
});
}
Upvotes: 0
Views: 1048
Reputation: 1861
From Jquery mobile docs: 'positionTo' parameter must be a string ('origin' or 'window') or a JQuery selector. In this case $(event.target) will work.
Upvotes: 1