site.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. function map() {
  2. var $carte = $('#carte');
  3. if ( $carte.length ) {
  4. var mymap = L.map('carte').setView([44.7365818, 4.9776488], 13);
  5. var greenIcon = L.icon({
  6. iconUrl: '/user/themes/lecampus/images/mappoint.svg',
  7. iconSize: [38, 95], // size of the icon
  8. iconAnchor: [22, 94], // point of the icon which will correspond to marker's location
  9. popupAnchor: [-3, -76] // point from which the popup should open relative to the iconAnchor
  10. });
  11. L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
  12. maxZoom: 18,
  13. id: 'mapbox.streets'
  14. }).addTo(mymap);
  15. L.marker([44.7365818, 4.9776488], {icon: greenIcon}).addTo(mymap);
  16. function onMapClick(e) {
  17. popup
  18. .setLatLng(e.latlng)
  19. .setContent("You clicked the map at " + e.latlng.toString())
  20. .openOn(mymap);
  21. }
  22. mymap.on('click', onMapClick);
  23. }
  24. }
  25. function filteritem() {
  26. var $card = $('.body-wrapper > .card');
  27. var $cat = $('.cat a');
  28. var $img = $('.body-wrapper .img');
  29. $(".filters .btn").click(function(e) {
  30. e.preventDefault();
  31. var filter = $(this).attr("data-filter");
  32. var self = $('.body-wrapper');
  33. self.masonryFilter({
  34. filter: function () {
  35. if (!filter) return true;
  36. return $(this).attr("data-filter") == filter;
  37. }
  38. });
  39. });
  40. var $grid = $('#archive .body-wrapper, #calendrier .body-wrapper').masonry({
  41. // columnWidth: 200,
  42. itemSelector: '.card',
  43. gutter: 10,
  44. transitionDuration: '0.2s'
  45. });
  46. // $( "a[hreflang|='en']" ).css( "border", "3px dotted green" );
  47. $grid.imagesLoaded().progress(function() {
  48. $grid.masonry();
  49. });
  50. }
  51. function slide() {
  52. $('.gal').bxSlider({
  53. responsive: true,
  54. infiniteLoop: true,
  55. preloadImages:'visible',
  56. pager:false,
  57. auto:true
  58. });
  59. $('.gal-salles').bxSlider({
  60. pagerType: 'full',
  61. responsive: true,
  62. mode: 'fade',
  63. captions: true,
  64. pagerSelector: '',
  65. });
  66. }
  67. function links() {
  68. var $a = $('li a[href="/organisez-vos-evenements"],li a[href="/qui-sommes-nous"] ');
  69. var $map = $('a#carte');
  70. $a.on('click', function(e) {
  71. e.preventDefault();
  72. })
  73. $map.on('click', function(e) {
  74. e.preventDefault();
  75. })
  76. }
  77. function clickbutton() {
  78. var $button = $('#ajax-test-form .radio label');
  79. $button.on('click', function(){
  80. $(this).parents('.form-data').find('.check').removeClass('check');
  81. $(this).parent('.radio').addClass('check');
  82. });
  83. }
  84. function clicksenddevis() {
  85. var $ok = $('.ok');
  86. var $send = $('#send-valide');
  87. $ok.on('click', function () {
  88. $(this).parent('#send-valide').remove();
  89. })
  90. }
  91. function addclass() {
  92. var $map = $('a#carte');
  93. $map.parents('.content_s').addClass('map')
  94. var $reco_click = $('#reco .title');
  95. var $reco_txt = $('#reco .txt');
  96. $reco_click.on('click', function() {
  97. $reco_txt.toggleClass('open');
  98. $(this).toggleClass('open');
  99. })
  100. var $out = $('.opt-out .txt');
  101. $out.on('click', function() {
  102. $(this).parent('.opt-out').toggleClass('open');
  103. })
  104. }
  105. function mapsalles() {
  106. var $salles = $('.fond svg path');
  107. var $content = $('.content .content_salle');
  108. arrayid = [];
  109. $('.content .content_salle#salle_trois_becs').css("visibility", "visible");
  110. $('.fond svg path#salle_trois_becs').css("fill", "#0093a3");
  111. $salles.on('click', function() {
  112. var idsalle = this.id;
  113. arrayid.push(idsalle);
  114. $salles.css("fill", "white");
  115. $(this).css("fill", "#0093a3");
  116. $('.content .content_salle').css("visibility", "hidden");
  117. $('.content .content_salle#'+arrayid).css("visibility", "visible");
  118. arrayid.length = 0;
  119. });
  120. var $close = $('.content_salle .header-salles img');
  121. $close.on('click', function () {
  122. console.log('close');
  123. $(this).parents('.content_salle').css("visibility", "hidden");
  124. })
  125. };
  126. function burger() {
  127. $('.navTrigger').click(function(){
  128. $(this).toggleClass('active');
  129. $('.dropmenu').toggleClass('active');
  130. });
  131. }
  132. function ajaxformulaire() {
  133. $(".ok").on('click', function () {
  134. $(this).parent('#send-valide').remove();
  135. location.reload();
  136. });
  137. var form = $('#ajax-test-form');
  138. form.submit(function(e) {
  139. // prevent form submission
  140. e.preventDefault();
  141. // submit the form via Ajax
  142. $.ajax({
  143. url: form.attr('action'),
  144. type: form.attr('method'),
  145. dataType: 'html',
  146. data: form.serialize(),
  147. success: function(result) {
  148. // Inject the result in the HTML
  149. $('#form-result').html(result);
  150. }
  151. });
  152. });
  153. }
  154. jQuery(document).ready(function(){
  155. // ajaxformulaire();
  156. addclass();
  157. mapsalles();
  158. clickbutton();
  159. clicksenddevis();
  160. links();
  161. slide();
  162. filteritem();
  163. map();
  164. burger();
  165. });