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. });
  65. }
  66. function links() {
  67. var $a = $('li a[href="/organisez-vos-evenements"],li a[href="/qui-sommes-nous"] ');
  68. var $map = $('a#carte');
  69. $a.on('click', function(e) {
  70. e.preventDefault();
  71. })
  72. $map.on('click', function(e) {
  73. e.preventDefault();
  74. })
  75. }
  76. function clickbutton() {
  77. var $button = $('#ajax-test-form .radio label');
  78. $button.on('click', function(){
  79. $(this).parents('.form-data').find('.check').removeClass('check');
  80. $(this).parent('.radio').addClass('check');
  81. });
  82. }
  83. function clicksenddevis() {
  84. var $ok = $('.ok');
  85. var $send = $('#send-valide');
  86. $ok.on('click', function () {
  87. $(this).parent('#send-valide').remove();
  88. })
  89. }
  90. function addclass() {
  91. var $map = $('a#carte');
  92. $map.parents('.content_s').addClass('map')
  93. var $reco_click = $('#reco .title');
  94. var $reco_txt = $('#reco .txt');
  95. $reco_click.on('click', function() {
  96. $reco_txt.toggleClass('open');
  97. $(this).toggleClass('open');
  98. })
  99. var $out = $('.opt-out .txt');
  100. $out.on('click', function() {
  101. $(this).parent('.opt-out').toggleClass('open');
  102. })
  103. }
  104. function mapsalles() {
  105. var $salles = $('.fond svg path');
  106. var $content = $('.content .content_salle');
  107. arrayid = [];
  108. $('.content .content_salle#salle_trois_becs').css("visibility", "visible");
  109. $('.fond svg path#salle_trois_becs').css("fill", "#0093a3");
  110. $salles.on('click', function() {
  111. var idsalle = this.id;
  112. arrayid.push(idsalle);
  113. $salles.css("fill", "white");
  114. $(this).css("fill", "#0093a3");
  115. $('.content .content_salle').css("visibility", "hidden");
  116. $('.content .content_salle#'+arrayid).css("visibility", "visible");
  117. arrayid.length = 0;
  118. });
  119. var $close = $('.content_salle .header-salles img');
  120. $close.on('click', function () {
  121. $(this).parents('.content_salle').css("visibility", "hidden");
  122. $salles.css("fill", "white");
  123. })
  124. };
  125. function burger() {
  126. $('.navTrigger').click(function(){
  127. $(this).toggleClass('active');
  128. $('.dropmenu').toggleClass('active');
  129. });
  130. }
  131. function ajaxformulaire() {
  132. $(".ok").on('click', function () {
  133. $(this).parent('#send-valide').remove();
  134. location.reload();
  135. });
  136. var form = $('#ajax-test-form');
  137. form.submit(function(e) {
  138. // prevent form submission
  139. e.preventDefault();
  140. // submit the form via Ajax
  141. $.ajax({
  142. url: form.attr('action'),
  143. type: form.attr('method'),
  144. dataType: 'html',
  145. data: form.serialize(),
  146. success: function(result) {
  147. // Inject the result in the HTML
  148. $('#form-result').html(result);
  149. }
  150. });
  151. });
  152. }
  153. jQuery(document).ready(function(){
  154. // ajaxformulaire();
  155. addclass();
  156. mapsalles();
  157. clickbutton();
  158. clicksenddevis();
  159. links();
  160. slide();
  161. filteritem();
  162. map();
  163. burger();
  164. });