Dear all.
I generated the code as below.
.Actually,the marker doesn't response to mousedown.
But it works well if I remove this -------marker.icon = icon
My question is How to change marker icons?
Thanks in advance.
function addMarker() {
var layer, markers;
var currentPopup;
markers = new OpenLayers.Layer.Markers("Markers");
map.addLayer(markers);
var size = new OpenLayers.Size(20, 20);
var offset = new OpenLayers.Pixel(-(size.w / 2), -size.h);
var icon = new OpenLayers.Icon('http://www.openlayers.org/dev/img/marker.png',
size, offset);
AutoSizeFramedCloud = OpenLayers.Class(OpenLayers.Popup.FramedCloud, {
'autoSize' : true
});
popupClass = AutoSizeFramedCloud;
popupContentHTML = '<img
src="http://www.openlayers.org/dev/img/marker.png"></img>'
var feature = new OpenLayers.Feature(markers, new
OpenLayers.LonLat(503810,4307378));
feature.closeBox = true;
feature.popupClass = popupClass;
feature.data.popupContentHTML = popupContentHTML;
feature.data.overflow = (true) ? "auto" : "hidden";
var marker = feature.createMarker();
marker.icon = icon
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);
};
marker.events.register("mousedown", feature, markerClick);
markers.addMarker(marker);
}_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users