M
M
mletov2018-02-21 13:44:49
JavaScript
mletov, 2018-02-21 13:44:49

How to hide InfoWindow on mouseout event from it?

Tell me, plz
There is a regular Google map with markers

var marker = new google.maps.Marker({
                                map: map, position: latlngset,
                                animation: google.maps.Animation.DROP,
                                category: IsBuild
                            });

When hovering over a marker, a tooltip pops up
google.maps.event.addListener(marker, 'mouseover', (function (marker, content, infowindow) {
                                return function () {
                                    if (content != null && content != "") {
                                        infowindow.setContent(content);
                                        infowindow.open(map, marker);

                                        if (marker.getAnimation() !== null) {
                                            marker.setAnimation(null);
                                        } else {
                                            marker.setAnimation(google.maps.Animation.BOUNCE);
                                            console.log(content);
                                        }
                                    }


                                };
                            })(marker, content, infowindow));

How to implement such that when the mouse leaves the marker or tooltip, the tooltip disappears.
But if the mouse left the tooltip, but remained on the marker, it did not disappear.
In jquery, a similar task is solved using nested divs via mouseenter/mouseleave.
I thought about creating custom hints, and already hanging handlers on them marcgrabanski.com/jquery-google-maps-tutorial-basics
But it's still not clear how to keep track that we are still on the marker. Is that to check the latitude and longitude, but it's somehow crooked.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question