site.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
  12. attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',
  13. tileSize: 512,
  14. maxZoom: 18,
  15. zoomOffset: -1,
  16. id: 'mapbox/streets-v11',
  17. accessToken: 'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw'
  18. }).addTo(mymap);
  19. // L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
  20. // maxZoom: 18,
  21. // id: 'mapbox.streets'
  22. // }).addTo(mymap);
  23. L.marker([44.7365818, 4.9776488], {icon: greenIcon}).addTo(mymap);
  24. function onMapClick(e) {
  25. popup
  26. .setLatLng(e.latlng)
  27. .setContent("You clicked the map at " + e.latlng.toString())
  28. .openOn(mymap);
  29. }
  30. mymap.on('click', onMapClick);
  31. }
  32. }
  33. function filteritem() {
  34. var $card = $('.body-wrapper > .card');
  35. var $cat = $('.cat a');
  36. var $img = $('.body-wrapper .img');
  37. $(".filters .btn").click(function(e) {
  38. // e.preventDefault();
  39. var filter = $(this).attr("data-filter");
  40. var self = $('.body-wrapper');
  41. self.masonryFilter({
  42. filter: function () {
  43. if (!filter) return true;
  44. return $(this).attr("data-filter") == filter;
  45. }
  46. });
  47. });
  48. var $grid = $('#archive .body-wrapper, #calendrier .body-wrapper').masonry({
  49. // columnWidth: 200,
  50. itemSelector: '.card',
  51. gutter: 40,
  52. transitionDuration: '0.2s'
  53. });
  54. $grid.imagesLoaded().progress(function() {
  55. $grid.masonry();
  56. });
  57. }
  58. function slide() {
  59. $('.gal').bxSlider({
  60. responsive: true,
  61. infiniteLoop: true,
  62. preloadImages:'visible',
  63. pager:false,
  64. auto:true
  65. });
  66. $('.gal-salles').slidesjs({
  67. width: 800,
  68. height: 533,
  69. navigation: true,
  70. pagination: false
  71. });
  72. }
  73. function links() {
  74. var $a = $('.dropmenu > ul > li > .no-click');
  75. var $map = $('a#carte');
  76. $a.on('click', function(e) {
  77. e.preventDefault();
  78. })
  79. $map.on('click', function(e) {
  80. e.preventDefault();
  81. })
  82. }
  83. function clickbutton() {
  84. var $button = $('#devis-form .radio label');
  85. $button.on('click', function(){
  86. $(this).parents('.form-data').find('.check').removeClass('check');
  87. $(this).parent('.radio').addClass('check');
  88. });
  89. }
  90. function clicksenddevis() {
  91. var $ok = $('.ok');
  92. var $send = $('#send-valide');
  93. $ok.on('click', function () {
  94. $(this).parent('#send-valide').remove();
  95. })
  96. }
  97. function addclass() {
  98. var $map = $('a#carte');
  99. $map.parents('.content_s').addClass('map')
  100. var $reco_click = $('#reco .title');
  101. var $reco_txt = $('#reco .txt');
  102. $reco_click.on('click', function() {
  103. $reco_txt.toggleClass('open');
  104. $(this).toggleClass('open');
  105. $('html, body').animate({scrollTop:$('#reco').position().top}, 'slow');
  106. })
  107. var $out = $('.opt-out .txt');
  108. $out.on('click', function() {
  109. $(this).parent('.opt-out').toggleClass('open');
  110. })
  111. }
  112. function mapsalles() {
  113. var $salles = $('.fond svg path');
  114. var $content = $('.content .content_salle');
  115. arrayid = [];
  116. $('.content .content_salle#salle_trois_becs').css("visibility", "visible");
  117. $('.fond svg path#salle_trois_becs').css("fill", "#0093a3");
  118. $salles.on('click', function(idsalle) {
  119. var idsalle = this.id;
  120. arrayid.push(idsalle);
  121. $salles.css("fill", "white");
  122. $(this).css("fill", "#0093a3");
  123. $('.content .content_salle').css("visibility", "hidden");
  124. $('.content .content_salle#'+arrayid).css("visibility", "visible");
  125. arrayid.length = 0;
  126. });
  127. var $close = $('.content_salle .header-salles img');
  128. $close.on('click', function () {
  129. $(this).parents('.content_salle').css("visibility", "hidden");
  130. $salles.css("fill", "white");
  131. })
  132. };
  133. function burger() {
  134. $('.navTrigger').click(function(){
  135. $(this).toggleClass('active');
  136. $('.dropmenu').toggleClass('active');
  137. });
  138. }
  139. function ajaxformulaire() {
  140. $(".ok").on('click', function () {
  141. $(this).parent('#send-valide').remove();
  142. location.reload();
  143. });
  144. var form = $('#devis-form');
  145. form.submit(function(e) {
  146. // prevent form submission
  147. e.preventDefault();
  148. // submit the form via Ajax
  149. $.ajax({
  150. url: form.attr('action'),
  151. type: form.attr('method'),
  152. dataType: 'html',
  153. data: form.serialize(),
  154. success: function(result) {
  155. // Inject the result in the HTML
  156. $('#form-result').html(result);
  157. }
  158. });
  159. });
  160. }
  161. function open_pack() {
  162. var $pack = $(".nos_pack .pack .__thumb");
  163. var nbrDiv = $pack.length;
  164. var widtWind = $( window ).width();
  165. if(widtWind <= 530){
  166. var count = 1;
  167. } else if (widtWind <= 1024) {
  168. var count = 2;
  169. } else if (widtWind <= 1200) {
  170. var count = 3;
  171. } else {
  172. var count = 4;
  173. }
  174. $pack.on('click',function(e) {
  175. var href = $(this).find('a').attr('href') ;
  176. if ( href == '#') {
  177. e.preventDefault();
  178. }
  179. var idThis = $(this).parent('.pack').attr('id');
  180. var $more = $('.__more#' + idThis);
  181. $('.__more').removeClass('visible');
  182. $('.triangle').removeClass('visible');
  183. var i = count;
  184. $more.addClass('visible');
  185. $(this).find('.triangle').addClass('visible')
  186. })
  187. var $close = $('.__more .close');
  188. $close.on('click' , function(e) {
  189. console.log('clsick');
  190. $(this).parents('.__more').removeClass('visible');
  191. $('.triangle').removeClass('visible');
  192. })
  193. }
  194. jQuery(document).ready(function(){
  195. tarteaucitron.init({
  196. "privacyUrl": "/charte-cookies", /* Privacy policy url */
  197. "hashtag": "#gestion_des_cookies", /* Open the panel with this hashtag */
  198. "cookieName": "gestion_des_cookies", /* Cookie name */
  199. "orientation": "bottom", /* Banner position (top - bottom) */
  200. "showAlertSmall": false, /* Show the small banner on bottom right */
  201. "cookieslist": false, /* Show the cookie list */
  202. "adblocker": false, /* Show a Warning if an adblocker is detected */
  203. "AcceptAllCta" : true, /* Show the accept all button when highPrivacy on */
  204. "highPrivacy": true, /* Disable auto consent */
  205. "handleBrowserDNTRequest": true, /* If Do Not Track == 1, disallow all */
  206. "removeCredit": false, /* Remove credit link */
  207. "moreInfoLink": true, /* Show more info link */
  208. "useExternalCss": true, /* If false, the tarteaucitron.css file will be loaded */
  209. //"cookieDomain": ".my-multisite-domaine.fr", /* Shared cookie for multisite */
  210. "readmoreLink": "/cookiespolicy" /* Change the default readmore link */
  211. });
  212. ajaxformulaire();
  213. addclass();
  214. mapsalles();
  215. clickbutton();
  216. clicksenddevis();
  217. links();
  218. slide();
  219. filteritem();
  220. map();
  221. burger();
  222. if ($('section').is("#nos-packs")) {
  223. open_pack();
  224. }
  225. });