-
-
Save jonrandahl/095b2c6c7e742253bfc1c97a6148a55e to your computer and use it in GitHub Desktop.
Force zIndex of Leaflet Marker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Force zIndex of Leaflet | |
| (function (global) { | |
| const MarkerMixin = { | |
| _updateZIndex: function (offset) { // offset at relative value, or put absolute zIndex value with forceZIndex | |
| this._icon.style.zIndex = isNaN(this.options.forceZIndex) // any no-numeric = unassigned. 0 is ok for the forceZIndex | |
| ? (this._zIndex + offset) | |
| : (this.options.forceZIndex + (this.options.zIndexOffset || 0)) | |
| }, | |
| setForceZIndex: function (forceZIndex) { | |
| this.options.forceZIndex = forceZIndex || null | |
| } | |
| } | |
| if (global) global.include(MarkerMixin) | |
| })(L.Marker) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment