Filialen

Außenansicht Filiale Freilassing ©abc Ladenbau

// Fixes potential theme css conflict. .acf-map img { max-width: inherit !important; } (function($) { /** * initMap * * Renders a Google Map onto the selected jQuery element * * @date 22/10/19 * @since 5.8.6 * * @param jQuery $el The jQuery element. * @return object The map instance. */ function initMap($el) { // Find marker elements within map. var $markers = $el.find('.marker'); var $markers = $el.find('.marker'); console.log($markers); // Create gerenic map. var mapArgs = { zoom: $el.data('zoom') || 16, mapTypeId: google.maps.MapTypeId.ROADMAP, scrollwheel: false, draggable: true, center: new google.maps.LatLng(0, 0), disableDefaultUI: true, styles: [{ "featureType": "administrative", "elementType": "geometry.fill", "stylers": [{ "saturation": "0" }] }, { "featureType": "administrative", "elementType": "geometry.stroke", "stylers": [{ "color": "#465C83" }, { "saturation": "0" }] }, { "featureType": "administrative", "elementType": "labels.text.fill", "stylers": [{ "color": "#465C83" }, { "saturation": "0" }] }, { "featureType": "administrative", "elementType": "labels.text.stroke", "stylers": [{ "visibility": "off" }] }, { "featureType": "administrative.locality", "elementType": "labels.icon", "stylers": [{ "color": "#465C83" }, { "saturation": "0" }, { "visibility": "on" }] }, { "featureType": "landscape", "elementType": "geometry.fill", "stylers": [{ "color": "#efebea" }, { "saturation": "0" }] }, { "featureType": "landscape", "elementType": "geometry.stroke", "stylers": [{ "color": "#af9d94" }, { "saturation": "0" }, { "visibility": "off" }] }, { "featureType": "landscape", "elementType": "labels.text.fill", "stylers": [{ "color": "#465C83" }, { "saturation": "0" }] }, { "featureType": "landscape", "elementType": "labels.text.stroke", "stylers": [{ "visibility": "off" }] }, { "featureType": "landscape.man_made", "elementType": "geometry.fill", "stylers": [{ "saturation": "0" }] }, { "featureType": "poi", "elementType": "geometry", "stylers": [{ "hue": "#ff0000" }, { "saturation": "34" }, { "visibility": "off" }] }, { "featureType": "poi", "elementType": "labels.text.fill", "stylers": [{ "color": "#465C83" }, { "saturation": "0" }] }, { "featureType": "poi", "elementType": "labels.text.stroke", "stylers": [{ "visibility": "off" }] }, { "featureType": "poi", "elementType": "labels.icon", "stylers": [{ "visibility": "off" }] }, { "featureType": "road", "elementType": "geometry.stroke", "stylers": [{ "visibility": "off" }] }, { "featureType": "road", "elementType": "labels.text.fill", "stylers": [{ "color": "#465C83" }] }, { "featureType": "road", "elementType": "labels.text.stroke", "stylers": [{ "visibility": "off" }] }, { "featureType": "road", "elementType": "labels.icon", "stylers": [{ "visibility": "off" }, { "lightness": "60" }, { "gamma": "1.00" }, { "hue": "#ff0000" }, { "saturation": "-90" }] }, { "featureType": "road.highway", "elementType": "geometry.fill", "stylers": [{ "color": "#ffffff" }, { "saturation": "0" }] }, { "featureType": "road.highway", "elementType": "labels.icon", "stylers": [{ "visibility": "simplified" }, { "hue": "#ff0000" }, { "weight": "0.01" }] }, { "featureType": "transit", "elementType": "geometry.fill", "stylers": [{ "color": "#bfb1a9" }, { "saturation": "0" }] }, { "featureType": "transit", "elementType": "geometry.stroke", "stylers": [{ "color": "#bfb1a9" }, { "saturation": "0" }] }, { "featureType": "transit", "elementType": "labels.text.fill", "stylers": [{ "color": "#465C83" }, { "saturation": "0" }] }, { "featureType": "transit", "elementType": "labels.text.stroke", "stylers": [{ "visibility": "off" }] }, { "featureType": "transit", "elementType": "labels.icon", "stylers": [{ "visibility": "on" }, { "hue": "#ff0000" }, { "saturation": "-90" }, { "lightness": "0" }, { "gamma": "1.00" }, { "weight": "1" }] }, { "featureType": "water", "elementType": "all", "stylers": [{ "color": "#dfd8d4" }, { "saturation": "0" }] }, { "featureType": "water", "elementType": "labels.text", "stylers": [{ "saturation": "0" }] }, { "featureType": "water", "elementType": "labels.text.fill", "stylers": [{ "color": "#465C83" }, { "saturation": "0" }] }, { "featureType": "water", "elementType": "labels.text.stroke", "stylers": [{ "visibility": "off" }] }, { "featureType": "water", "elementType": "labels.icon", "stylers": [{ "visibility": "off" }] }] }; var map = new google.maps.Map($el[0], mapArgs); // Add markers. map.markers = []; $markers.each(function() { initMarker($(this), map); }); // Center map based on markers. centerMap(map); // Return map instance. return map; } /** * initMarker * * Creates a marker for the given jQuery element and map. * * @date 22/10/19 * @since 5.8.6 * * @param jQuery $el The jQuery element. * @param object The map instance. * @return object The marker instance. */ function initMarker($marker, map) { // Get position from marker. var lat = $marker.data('lat'); var lng = $marker.data('lng'); var latLng = { lat: parseFloat(lat), lng: parseFloat(lng) }; var image = { url: 'https://baecker-brueder.de/wp-content/themes/baecker-brueder-2022/src/images/svg/map-marker.svg', // This marker is 20 pixels wide by 32 pixels high. size: new google.maps.Size(40, 30), // The origin for this image is (0, 0). origin: new google.maps.Point(0, 0), // The anchor for this image is the base of the flagpole at (0, 32). anchor: new google.maps.Point(16, 48) }; // Create marker instance. var marker = new google.maps.Marker({ position: latLng, map: map, title: 'Zum Google Routenplaner', icon: image }); // Append to reference for later use. map.markers.push(marker); // If marker contains HTML, add it to an infoWindow. if ($marker.html()) { // Create info window. var infowindow = new google.maps.InfoWindow({ content: $marker.html() }); // Show info window when marker is clicked. google.maps.event.addListener(marker, 'click', function() { infowindow.open(map, marker); }); } } /** * centerMap * * Centers the map showing all markers in view. * * @date 22/10/19 * @since 5.8.6 * * @param object The map instance. * @return void */ function centerMap(map) { // Create map boundaries from all map markers. var bounds = new google.maps.LatLngBounds(); map.markers.forEach(function(marker) { bounds.extend({ lat: marker.position.lat(), lng: marker.position.lng() }); }); // Case: Single marker. if (map.markers.length == 1) { map.setCenter(bounds.getCenter()); // Case: Multiple markers. } else { map.fitBounds(bounds); } } // Render maps on page load. $(document).ready(function() { $('.acf-map').each(function() { var map = initMap($(this)); }); }); })(jQuery);