infoWindow mouse out event ?

1605
3
11-14-2013 01:28 AM
GISTeam2
New Contributor II
Hi,

Was wondering if there is a way to assign a mouse out event to a maps infoWindow ?

I have added a feature layer to a map and have it so that when a user hovers over one of the features, the infoWindow pops up. Would like to make it so that the infoWindow is hidden when the user 'mousesOut' of the infoWindow.  Have tried 

map.infoWindow.on("mouse-out", function(evt){
      map.infoWindow.hide();
  });

No javascript error but it doesn't work.

Thanks
0 Kudos
3 Replies
JohnGravois
Frequent Contributor
hi AJ111, welcome to the forums!

i did a quick check and confirmed in the API reference that the infoWindow class doesn't have a 'mouse-out' event, but rather only 'show' and 'hide'.  this explains why you are having trouble wiring it up.
0 Kudos
JasonZou
Occasional Contributor III
Try to use dojo/on as below.

on(map.infoWindow.domNode, "mouseout", function() {
    map.infoWindow.hide();
});
0 Kudos
GISTeam2
New Contributor II
Thanks for the replies..

Jason , l tried something similar by extending the InfoWindowBase class , as in the https://developers.arcgis.com/en/javascript/jssamples/widget_extendInfowindow.html example.

I added

on(this.domNode, "mouseout", lang.hitch(this, function(){
          this.hide();
          }));

to the InfoWindowBase class in an attempt to add the mouseout event. After doing this an event fires in my page but not with the hoped for results - the infoWindow 'hides' but not when i want it to, sort of more of a mouseover effect than a mouseout. I will try and learn more about domNodes.
0 Kudos