Skip to content

Instantly share code, notes, and snippets.

@patrickarlt
Last active January 2, 2016 09:59
Show Gist options
  • Save patrickarlt/8286710 to your computer and use it in GitHub Desktop.
Save patrickarlt/8286710 to your computer and use it in GitHub Desktop.
Custom marker with override.
// Subclass marker
var CustomMarker = L.Marker.extend({
// override the update function
update: function(){
//call the original update method
L.Marker.prototype.update.call(this);
// fire the update event
this.fire("update");
// return 'this' to make it chainable
return this;
}
});
// use like a regular marker
var myMarker = new CustomMarker([45.51, -122.67]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment