[OpenLayers-Users] Re: Marker events register

Damien dawadam at gmail.com
Wed Feb 22 05:10:28 EST 2012


bishop <bishop at ...> writes:

> 
> 
> jhpoosthoek wrote:
> > 
> > Is it possible to change the mouse cursor into a pointer when you
> > 'mouseover' a marker? In CSS this would be cursor: "pointer". But I don't
> > know how to add that to the marker object.
> > 
> 
> OpenLayers (as of version 2.10) doesn't class icon markers, but their id do
> always end in "_innerImage".  So, use the CSS attribute selector "splat" to
> style markers:
> 
> img[id *= "_innerImage"]:hover { cursor:pointer; }
> 
> Should work in FF, Chrome, Safari, Opera, and IE7+.  Screen shot attached
> shows what it looks like in Firebug.
>
http://osgeo-org.1803224.n2.nabble.com/file/n6781478/marker-icon-cursor-pointer.png 
> 
> --
> View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Marker-events-register-hover-tp4436306p6781478.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> 


Hello
You can change cursor whith javascript, like this:

	var mapDiv = document.getElementById("map");

	eventMarkerOver = function() {
		mapDiv.style.cursor = "pointer";
	};
	eventMarkerOut = function() {
		mapDiv.style.cursor = "default";
	};

	var m = new OpenLayers.Marker(position, icon);

	m.events.register("mouseover", m, eventMarkerOver);
	m.events.register("mouseout", m, eventMarkerOut);

Damien



More information about the Users mailing list