MoreScratch
MoreScratch

Reputation: 3083

How to add a mouseover/mouseout listener to a ol.Map?

In ol2 I used to use:

map.on( "mouseover mouseout", function( evt ) {...});

How can I do this in ol3?

Upvotes: 4

Views: 2726

Answers (1)

Jonatas Walker
Jonatas Walker

Reputation: 14150

Take a look at this plunker, there's a lot of other possibilities:

What you ask is done with:

map.on('pointermove', function(event) {

});

Mouseout:

map.getViewport().addEventListener('mouseout', function(evt){
    console.info('out');
}, false);

Upvotes: 10

Related Questions