209 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			209 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| function map() {
 | |
|   var $carte = $('#carte');
 | |
|   if ( $carte.length ) {
 | |
| 
 | |
|     var mymap = L.map('carte').setView([44.7365818, 4.9776488], 13);
 | |
| 
 | |
|     var greenIcon = L.icon({
 | |
|         iconUrl: '/user/themes/lecampus/images/mappoint.svg',
 | |
| 
 | |
|         iconSize:     [38, 95], // size of the icon
 | |
|         iconAnchor:   [22, 94], // point of the icon which will correspond to marker's location
 | |
|         popupAnchor:  [-3, -76] // point from which the popup should open relative to the iconAnchor
 | |
|     });
 | |
| 
 | |
|   	L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
 | |
|   		maxZoom: 18,
 | |
|   		id: 'mapbox.streets'
 | |
|   	}).addTo(mymap);
 | |
| 
 | |
|   	L.marker([44.7365818, 4.9776488], {icon: greenIcon}).addTo(mymap);
 | |
| 
 | |
|   	function onMapClick(e) {
 | |
|   		popup
 | |
|   			.setLatLng(e.latlng)
 | |
|   			.setContent("You clicked the map at " + e.latlng.toString())
 | |
|   			.openOn(mymap);
 | |
|   	}
 | |
| 
 | |
|   	mymap.on('click', onMapClick);
 | |
| 
 | |
|   }
 | |
| }
 | |
| 
 | |
| function filteritem() {
 | |
|   var $card = $('.body-wrapper > .card');
 | |
|   var $cat = $('.cat a');
 | |
|   var $img = $('.body-wrapper .img');
 | |
| 
 | |
|   $(".filters .btn").click(function(e) {
 | |
|     e.preventDefault();
 | |
| 
 | |
|     var filter = $(this).attr("data-filter");
 | |
|     var self = $('.body-wrapper');
 | |
| 
 | |
|     self.masonryFilter({
 | |
|         filter: function () {
 | |
|             if (!filter) return true;
 | |
|             return $(this).attr("data-filter") == filter;
 | |
|         }
 | |
|     });
 | |
| });
 | |
| 
 | |
|   var $grid = $('#archive .body-wrapper, #calendrier .body-wrapper').masonry({
 | |
|     // columnWidth: 200,
 | |
|     itemSelector: '.card',
 | |
|     gutter: 10,
 | |
|     transitionDuration: '0.2s'
 | |
|   });
 | |
| 
 | |
| // $( "a[hreflang|='en']" ).css( "border", "3px dotted green" );
 | |
|   $grid.imagesLoaded().progress(function() {
 | |
|       $grid.masonry();
 | |
|   });
 | |
| 
 | |
| }
 | |
| 
 | |
| function slide() {
 | |
|   $('.gal').bxSlider({
 | |
|     responsive: true,
 | |
|     infiniteLoop: true,
 | |
|     preloadImages:'visible',
 | |
|     pager:false,
 | |
|     auto:true
 | |
|   });
 | |
| 
 | |
| 
 | |
|   $('.gal-salles').bxSlider({
 | |
|     pagerType: 'full',
 | |
|     responsive: true,
 | |
|     mode: 'fade',
 | |
|     captions: true,
 | |
|     });
 | |
| 
 | |
| }
 | |
| 
 | |
| function links() {
 | |
|   var $a = $('li a[href="/organisez-vos-evenements"],li a[href="/qui-sommes-nous"] ');
 | |
|   var $map = $('a#carte');
 | |
| 
 | |
|   $a.on('click', function(e) {
 | |
|     e.preventDefault();
 | |
|   })
 | |
| 
 | |
|   $map.on('click', function(e) {
 | |
|     e.preventDefault();
 | |
|   })
 | |
| }
 | |
| 
 | |
| function clickbutton() {
 | |
|   var $button = $('#ajax-test-form .radio label');
 | |
| 
 | |
|   $button.on('click', function(){
 | |
|     $(this).parents('.form-data').find('.check').removeClass('check');
 | |
|     $(this).parent('.radio').addClass('check');
 | |
|   });
 | |
| 
 | |
| }
 | |
| 
 | |
| function clicksenddevis() {
 | |
|   var $ok = $('.ok');
 | |
|   var $send = $('#send-valide');
 | |
| 
 | |
|   $ok.on('click', function () {
 | |
|     $(this).parent('#send-valide').remove();
 | |
|   })
 | |
| 
 | |
| }
 | |
| 
 | |
| function addclass() {
 | |
|   var $map = $('a#carte');
 | |
| 
 | |
|   $map.parents('.content_s').addClass('map')
 | |
| 
 | |
|   var $reco_click = $('#reco .title');
 | |
|   var $reco_txt = $('#reco .txt');
 | |
| 
 | |
|   $reco_click.on('click', function() {
 | |
|     $reco_txt.toggleClass('open');
 | |
|     $(this).toggleClass('open');
 | |
|   })
 | |
| 
 | |
|   var $out = $('.opt-out .txt');
 | |
| 
 | |
|   $out.on('click', function() {
 | |
|     $(this).parent('.opt-out').toggleClass('open');
 | |
|   })
 | |
| }
 | |
| 
 | |
| function mapsalles() {
 | |
|   var $salles = $('.fond svg path');
 | |
|   var $content = $('.content .content_salle');
 | |
|   arrayid = [];
 | |
|   $('.content .content_salle#salle_trois_becs').css("visibility", "visible");
 | |
|   $('.fond svg path#salle_trois_becs').css("fill", "#0093a3");
 | |
| 
 | |
|   $salles.on('click', function(idsalle) {
 | |
|     var idsalle = this.id;
 | |
| 
 | |
|     arrayid.push(idsalle);
 | |
|     $salles.css("fill", "white");
 | |
|     $(this).css("fill", "#0093a3");
 | |
|     $('.content .content_salle').css("visibility", "hidden");
 | |
|     $('.content .content_salle#'+arrayid).css("visibility", "visible");
 | |
|     arrayid.length = 0;
 | |
|   });
 | |
| 
 | |
|   var $close = $('.content_salle .header-salles img');
 | |
|   $close.on('click', function () {
 | |
|     $(this).parents('.content_salle').css("visibility", "hidden");
 | |
|     $salles.css("fill", "white");
 | |
|   })
 | |
| };
 | |
| 
 | |
| function burger() {
 | |
|   $('.navTrigger').click(function(){
 | |
|     $(this).toggleClass('active');
 | |
|     $('.dropmenu').toggleClass('active');
 | |
|   });
 | |
| }
 | |
| 
 | |
| function ajaxformulaire() {
 | |
|   $(".ok").on('click', function () {
 | |
|     $(this).parent('#send-valide').remove();
 | |
|     location.reload();
 | |
|   });
 | |
| 
 | |
|   var form = $('#ajax-test-form');
 | |
|   form.submit(function(e) {
 | |
|       // prevent form submission
 | |
|       e.preventDefault();
 | |
| 
 | |
|       // submit the form via Ajax
 | |
|       $.ajax({
 | |
|           url: form.attr('action'),
 | |
|           type: form.attr('method'),
 | |
|           dataType: 'html',
 | |
|           data: form.serialize(),
 | |
|           success: function(result) {
 | |
|               // Inject the result in the HTML
 | |
|               $('#form-result').html(result);
 | |
|           }
 | |
|       });
 | |
|   });
 | |
| 
 | |
| }
 | |
| 
 | |
| jQuery(document).ready(function(){
 | |
|   // ajaxformulaire();
 | |
|   addclass();
 | |
|   mapsalles();
 | |
|   clickbutton();
 | |
|   clicksenddevis();
 | |
|   links();
 | |
|   slide();
 | |
|   filteritem();
 | |
|   map();
 | |
|   burger();
 | |
| });
 |