[OpenLayers-Users] markers feature
Biribu
pabloblo85 at yahoo.es
Thu Jul 26 02:41:19 PDT 2012
You could add that id as popupcontentHTML, so whenever you click over the
marker, it will display a window showing its id.
You can create it creating a Feature, and associating it with your marker
layer and the marker.lonlat... Check api but maybe this helps:
popFeature = new OpenLayers.Feature(markers, location);
popFeature.closeBox = true;
popFeature.popupClass =
OpenLayers.Class(OpenLayers.Popup.FramedCloud, {
'autoSize': true
});;
popFeature.data.popupContentHTML = "hi"; //Here you write
your id
popFeature.data.overflow = (false) ? "auto" : "hidden";
var markerClick = function (evt) {
if (this.popup == null) {
this.popup = this.createPopup(this.closeBox);
map.addPopup(this.popup);
this.popup.show();
} else {
this.popup.toggle();
}
currentPopup = this.popup;
OpenLayers.Event.stop(evt);
};
mark.events.register("mousedown", popFeature, markerClick);
Each time you press your marker, it will display your id.
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/markers-feature-tp4990999p4991003.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list