Raggio: Chiuso
Raggio:
km Set radius for geolocation
Cerca
')); jQuery('.elm-search-form.radius-clone').append($radiusPopup); var formRadiusInput = jQuery('.elm-search-form.radius-clone [name="rad"]').clone(); $radiusContainer.append(formRadiusInput); formRadiusInput.attr('type', 'hidden'); jQuery(window).resize(function() { updateRadiusCloneDimensions($radiusPopup); }); }); function setGeoData() { if(navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { //var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); jQuery("#latitude-search").attr('value', position.coords.latitude); jQuery("#longitude-search").attr('value', position.coords.longitude); }); } } function openRadiusPopup(popup) { jQuery('body').addClass('radius-open'); setTimeout(() => { updateRadiusCloneDimensions(popup); popup.parent().addClass('active'); popup.removeClass('radius-input-hidden').addClass('radius-input-visible'); }, 100); } function updateRadiusCloneDimensions(popup) { $radiusContainer = jQuery('#elm-search-form-e53cd1fe6292d2 .radius'); $radiusClone = popup.parent(); var radiusContainerPosition = $radiusContainer.offset(); var radiusContainerWidth = $radiusContainer.outerWidth() + 'px'; var radiusContainerHeight = $radiusContainer.outerHeight() + 'px'; $radiusClone.css(radiusContainerPosition); $radiusClone.css('width', radiusContainerWidth); $radiusClone.css('height', radiusContainerHeight); var offscreen = popupOffscreen(popup); if (popupOffscreen(popup) != 0) { $radiusClone.css('left', $radiusClone.offset().left + offscreen); popup.addClass('off-screen'); } else { popup.removeClass('off-screen'); } } function closeRadiusPopup(popup) { popup.removeClass('radius-input-visible').addClass('radius-input-hidden'); popup.parent().removeClass('active').removeAttr('style'); jQuery('body').removeClass('radius-open'); } function popupOffscreen(popup) { var offsetRight = jQuery(window).width() - (popup.offset().left + popup.outerWidth()); var offsetLeft = popup.offset().left; return offsetLeft

Blog