// $(window).on("load", function() { // loaderPage(true); // }); $(document).ready(function() { // loaderPage(true); const $valueSpan = $('.valueSpan'); const $value_address = $('#slider-address'); const $value_point = $('#slider-point'); $valueSpan.html($value_address.val()); $value_address.on('input change', () => { $valueSpan.html($value_address.val()); }); $valueSpan.html($value_point.val()); $value_point.on('input change', () => { $valueSpan.html($value_point.val()); }); }); var lat, lng, latlng; var container = $(".leaflet-control-layers")[0]; var markerClusters = new L.MarkerClusterGroup({ spiderfyOnMaxZoom: true, showCoverageOnHover: false, zoomToBoundsOnClick: true, disableClusteringAtZoom: 16 }); var marker = {}; $(window).resize(function() { sizeLayerControl(); }); if (!("ontouchstart" in window)) { $(document).on("mouseover", ".feature-row", function(e) { highlight.clearLayers().addLayer(L.circleMarker([$(this).attr("lat"), $(this).attr("lng")], highlightStyle)); }); } $(document).on("mouseout", ".feature-row", clearHighlight); $("#about-btn").click(function() { $("#aboutModal").modal("show"); $(".navbar-collapse.in").collapse("hide"); return false; }); $("#login-btn").click(function() { $("#loginModal").modal("show"); $(".navbar-collapse.in").collapse("hide"); return false; }); $("#list-btn").click(function() { animateSidebar(); return false; }); $("#nav-btn").click(function() { $(".navbar-collapse").collapse("toggle"); return false; }); function animateSidebar() { $("#sidebar").animate({ width: "toggle" }, 350, function() { map.invalidateSize(); }); } function sizeLayerControl() { $(".leaflet-control-layers").css("max-height", $("#map").height() - 50); } function clearHighlight() { highlight.clearLayers(); } var highlight = L.geoJson(null); var highlightStyle = { stroke: false, fillColor: "#00FFFF", fillOpacity: 0.7, radius: 10 }; map.on("click", function(e) { highlight.clearLayers(); }); function updateAttribution(e) { $.each(map._layers, function(index, layer) { if (layer.getAttribution) { $("#attribution").html((layer.getAttribution())); } }); } map.on("layeradd", updateAttribution); map.on("layerremove", updateAttribution); var attributionControl = L.control({ position: "bottomright" }); attributionControl.onAdd = function(map) { var div = L.DomUtil.create("div", "leaflet-control-attribution"); return div; }; map.addControl(attributionControl); var zoomControl = L.control.zoom({ position: "bottomright" }).addTo(map); var locateControl = L.control.locate({ position: "bottomright", drawCircle: false, follow: true, setView: true, keepCurrentZoomLevel: false, markerStyle: { weight: 1, opacity: 0.8, fillOpacity: 0.8 }, circleStyle: { weight: 1, clickable: false }, icon: "fa fa-map-marker", metric: false, strings: { title: "My location", }, locateOptions: {} }).addTo(map); if (document.body.clientWidth <= 767) { var isCollapsed = true; } else { var isCollapsed = false; } $("#featureModal").on("hidden.bs.modal", function(e) { $(document).on("mouseout", ".feature-row", clearHighlight); });