// RESIZE COLORBAR

function setWidthForColorbars() {
    const colorbars = document.querySelectorAll('.leaflet-control-colorbar');
    colorbars.forEach(colorbar => {
	const info = document.querySelector('.info').offsetWidth;
	colorbar.style.maxWidth = info.toString() + 'px';
    });
}

$(document).ready(function () {
    $(document).on('click', "#models-apply, .DayPicker, .SingleDatePickerInput_clearDate", function () {
	setTimeout(setWidthForColorbars, 500);
    })
})

$(document).ready(function () {
    setTimeout(setWidthForColorbars, 1500);
});
