Reputation: 573
Hello can some one tell me how to add a custom link to openlayer maps marker? I want to be able to open a hidden div when i press the marker. I am trying to do something like this http://www.porcelanosa.com/showroom-locator however i can only add simple information via the pop up feature of the marker via text file. Right now i am using the WP plugin (OpenStreetMap Plugin V2.4.1). I tried multiple examples however none of them shows how to add a custom link to the marker
Upvotes: 0
Views: 1698
Reputation: 5039
you can register a listener on your marker. A full example can be found here: Markers Layer Example.
marker.events.register('mousedown', marker,
function(evt) {
alert(this.icon.url); OpenLayers.Event.stop(evt);
}
);
if you are using a vector layer, you could register a feature selection event on it:
var myLayer = new OpenLayers.Layer.Vector(locale.layerStationMarkers, {
eventListeners: {
"featureselected": onFeatureSelectMethod(),
"featureunselected": onStationFeatureUnselect()
}
});
Upvotes: 1