Skip to content

Commit

Permalink
unbind click listeners onRemove
Browse files Browse the repository at this point in the history
  • Loading branch information
Stan Tsouvallas committed Oct 1, 2017
1 parent c2be2e4 commit f1a67de
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion SliderControl.js
Expand Up @@ -88,6 +88,10 @@ L.Control.SliderControl = L.Control.extend({
map.removeLayer(this.options.markers[i]);
}
$('#leaflet-slider').remove();

// unbind listeners to prevent memory leaks
$(document).off("mouseup");
$(".slider").off("mousedown");
},

startSlider: function () {
Expand Down Expand Up @@ -128,7 +132,7 @@ L.Control.SliderControl = L.Control.extend({
console.error("Time property "+ _options.timeAttribute +" not found in data");
}
}

var i;
// clear markers
for (i = _options.minValue; i <= _options.maxValue; i++) {
Expand Down

0 comments on commit f1a67de

Please sign in to comment.