Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open and/or close the infowindow on mouse over/out #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions dist/snazzy-info-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@
placement: 'top',
pointer: true,
openOnMarkerClick: true,
openOnMarkerMouseOver: false,
closeOnMarkerMouseOut: false,
closeOnMapClick: true,
closeWhenOthersOpen: false,
showCloseButton: true,
Expand Down Expand Up @@ -226,7 +228,25 @@
}
}), true);
}


// This listener remains active when the info window is closed.
if (_this._marker && _this._opts.openOnMarkerMouseOver) {
_this.trackListener(google.maps.event.addListener(_this._marker, 'mouseover', function () {
if (!_this.getMap()) {
_this.open();
}
}), true);
}

// This listener remains active when the info window is closed.
if (_this._marker && _this._opts.closeOnMarkerMouseOut) {
_this.trackListener(google.maps.event.addListener(_this._marker, 'mouseout', function () {
if (_this.getMap()) {
_this.close();
}
}), true);
}

// When using a position the default option for the offset is 0
if (_this._position && !_this._opts.offset) {
_this._opts.offset = {
Expand Down Expand Up @@ -755,4 +775,4 @@

exports.default = SnazzyInfoWindow;
module.exports = exports['default'];
});
});