🏠 Root
/
home
/
artorgp
/
www
/
wp-content
/
themes
/
olorun
/
assets
/
js
/
Editing: scripts.js
jQuery(document).ready(function($){ $(".burger").click(function() { $('.header-menu').toggleClass("on"); $('.burger').toggleClass("on"); $('.burger-menu').toggleClass("on"); }); }); jQuery(document).ready(function($){ $("<i><span></span></i>").insertBefore(".sub-menu"); $("i").click(function(){ $(this).next(".sub-menu").slideToggle('3000'); }); }); jQuery(document).ready(function($){ $('.open-search-page').on('click', function() { $('body').addClass('openSearch'); }); $('.close-search').on('click', function() { $('body').removeClass('openSearch'); }); }); jQuery(document).ready(function($){ $(window).scroll(function () { var sc = $(window).scrollTop(); var scrollHeight = $(document).height() - $(window).height(); if (sc > 150 /* && scrollHeight > 280*/) { $(".site-header").addClass("on"); } else { $(".site-header").removeClass("on"); } }); }); function showMap() { var x = document.getElementById("country-map"); var y = document.getElementById("button-show"); if (x.style.display === "none") { x.style.display = "block"; y.innerHTML = 'Masquer la carte'; } else { x.style.display = "none"; y.innerHTML = 'Afficher la carte'; } } function changeView() { var x = document.getElementById("last-elements"); var y = document.getElementById("abc-elements"); var z = document.getElementById("change-view"); if (x.style.display === "none") { x.style.display = "block"; y.style.display = "none"; z.innerHTML = 'Lister par ordre alphabetique.'; } else if (y.style.display === "none") { x.style.display = "none"; y.style.display = "block"; z.innerHTML = 'Lister les derniers articles'; } } /*jQuery(document).ready(function($){ $(".show-register").click(function() { var modalbg = document.createElement("div"); document.querySelector('.lwa-register').setAttribute('style', 'display: block;position:fixed;top: 12vh;opacity: 1;visibility: visible;'); document.querySelector('.lwa-register').insertBefore(modalbg, list.children[0]); document.querySelector('body').setAttribute('style', 'background: #5d5d5d99;'); }); }); */ (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'); // Create gerenic map. var mapArgs = { zoom : $el.data('zoom') || 16, mapTypeId : google.maps.MapTypeId.ROADMAP }; 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 ) }; // Create marker instance. var marker = new google.maps.Marker({ position : latLng, map: map }); // Append to reference for later use. map.markers.push( marker ); // If marker contains HTML, add it to an infoWindow. if( $marker.data('title') ) { // Create info window. if( $marker.data('url') ) { var myLink = ' <a href="' + $marker.data('url') +'">Consulter ce lieu</a>.'; } else { var myLink = ''; } var myHtml = $marker.data('title') + myLink; var infowindow = new google.maps.InfoWindow({ content: myHtml }); // 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); // ajax search filters for artists jQuery(function($){ $('#filter').submit(function(){ var filter = $('#filter'); $.ajax({ url:filter.attr('action'), data:filter.serialize(), // form data type:filter.attr('method'), // POST beforeSend:function(xhr){ filter.find('button').text('...'); // changing the button label }, success:function(data){ $('#response').html(data); // insert data filter.find('button').text('Rechercher'); // changing the button label back } }); return false; }); });
Save
Cancel