[OpenLayers-Users] mouseover, mouseout events for getting popups

bernhard zwischenbrugger bz at datenkueche.com
Fri Aug 5 15:34:39 EDT 2011


Hi Jonnala

I had the same problem und solved it by adding the mouseover, mouseout 
events
to the html element.
To find the html element see doc or ask debugger:
console.log(marker);
To add the event I used the javascript methods
eventAttach and addEventListener.

I couldn't find an easier way to do that.
If there is an easier way to do that - I'm nosy.

Bernhard

On 2011-08-05 20:33, sjonnala wrote:
> Hi There,
>    My present application supports mouseclick event to display a popup
> containing some information. I'm trying to implement mouseover, mouseout
> events also along with the existing event popup. Something like below.
>
>          marker.events.register('mouseover', feature,
> LayerDisplay.mouseover);
>          marker.events.register('click', feature, LayerDisplay.markerClick);
>          marker.events.register('mouseout', feature, LayerDisplay.mouseout);
>
>      markerClick: function(evt)
>      {
>          sameMarkerClicked = (this == selectedFeature);
>          selectedFeature = (!sameMarkerClicked) ? this : null;
>
>          for(var i=0; i<  ti_Markers.map.popups.length; i++) {
>              ti_Markers.map.removePopup(ti_Markers.map.popups[i]);
>          }
>
>          var anchor=(this.marker)?this.marker.icon:null;
>
>          popup = new
> OpenLayers.Popup.Anchored("olPopup",this.data.latlon,null,this.data.popupContentHTML,anchor,true)
>
>          if (!sameMarkerClicked) {
>              ti_Markers.map.addPopup(popup);
>          }
>          OpenLayers.Event.stop(evt);
>      }
>
>      mouseover: function(evt) {
>       //....implementation....
>      }
>      mouseout: function(evt) {
>      //....implementation....
>      }
>
>
>
> Partially i was able to achieve this for mouseover. But after mouseover
> event, the markerClick function is never getting called with 'click' event.
> registering 'click' alone works great.
>
> Can anyone please help me how to achieve this functionality. Thanks in
> advance.
> ----
> Satish Jonnala
>
> --
> View this message in context: http://osgeo-org.1803224.n2.nabble.com/mouseover-mouseout-events-for-getting-popups-tp6657567p6657567.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list