Skip to content

Instantly share code, notes, and snippets.

@lenisko
Created August 25, 2021 00:17
Show Gist options
  • Save lenisko/de5c80eb6d2199c0161982a1d8c51634 to your computer and use it in GitHub Desktop.
Save lenisko/de5c80eb6d2199c0161982a1d8c51634 to your computer and use it in GitHub Desktop.
// Force zIndex of Leaflet
(function(global){
var MarkerMixin = {
_updateZIndex: function (offset) {
this._icon.style.zIndex = this.options.forceZIndex ? (this.options.forceZIndex + (this.options.zIndexOffset || 0)) : (this._zIndex + offset);
},
setForceZIndex: function(forceZIndex) {
this.options.forceZIndex = 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