function map() {
mapboxgl.accessToken = 'pk.eyJ1Ijoia2V2aW50ZXNzaWVyIiwiYSI6ImNrMGdqbjZsczAweWkzcW5yMWt4M2UzamYifQ.Tfarhi-XqGp7iIpwfANSGg';
var map = new mapboxgl.Map({
container: 'carte',
style: 'mapbox://styles/mapbox/streets-v11',
center: [4.9776488, 44.7365818],
zoom: 12,
});
map.addControl(new mapboxgl.NavigationControl());
var marker = new mapboxgl.Marker()
.setLngLat([4.9776488, 44.7365818])
.addTo(map);
var markerHeight = 50, markerRadius = 10, linearOffset = 25;
var popupOffsets = {
'top': [0, 0],
'top-left': [0,0],
'top-right': [0,0],
'bottom': [0, -markerHeight],
'bottom-left': [linearOffset, (markerHeight - markerRadius + linearOffset) * -1],
'bottom-right': [-linearOffset, (markerHeight - markerRadius + linearOffset) * -1],
'left': [markerRadius, (markerHeight - markerRadius) * -1],
'right': [-markerRadius, (markerHeight - markerRadius) * -1]
};
var popup = new mapboxgl.Popup({offset: popupOffsets, className: 'my-class'})
.setLngLat(e.lngLat)
.setHTML("
Hello World!
")
.setMaxWidth("300px")
.addTo(map);
var nav = new mapboxgl.NavigationControl();
map.addControl(nav, 'top-left');
}
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: 40,
transitionDuration: '0.2s'
});
$grid.imagesLoaded().progress(function() {
$grid.masonry();
});
}
function slide() {
$('.gal').bxSlider({
responsive: true,
infiniteLoop: true,
preloadImages:'visible',
pager:false,
auto:true
});
$('.gal-salles').slidesjs({
width: 800,
height: 533,
navigation: true,
pagination: false
});
}
function links() {
var $a = $('.dropmenu > ul > li > .no-click');
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');
$('html, body').animate({scrollTop:$('#reco').position().top}, 'slow');
})
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);
}
});
});
}
function open_pack() {
var $pack = $(".nos_pack .pack .__thumb");
var nbrDiv = $pack.length;
var widtWind = $( window ).width();
if(widtWind <= 530){
var count = 1;
} else if (widtWind <= 1024) {
var count = 2;
} else if (widtWind <= 1200) {
var count = 3;
} else {
var count = 4;
}
$pack.on('click',function(e) {
var href = $(this).find('a').attr('href') ;
if ( href == '#') {
e.preventDefault();
}
var idThis = $(this).parent('.pack').attr('id');
var $more = $('.__more#' + idThis);
$('.__more').removeClass('visible');
$('.triangle').removeClass('visible');
var i = count;
$more.addClass('visible');
$(this).find('.triangle').addClass('visible')
})
var $close = $('.__more .close');
$close.on('click' , function(e) {
console.log('clsick');
$(this).parents('.__more').removeClass('visible');
$('.triangle').removeClass('visible');
})
}
jQuery(document).ready(function(){
tarteaucitron.init({
"privacyUrl": "/charte-cookies", /* Privacy policy url */
"hashtag": "#gestion_des_cookies", /* Open the panel with this hashtag */
"cookieName": "gestion_des_cookies", /* Cookie name */
"orientation": "bottom", /* Banner position (top - bottom) */
"showAlertSmall": false, /* Show the small banner on bottom right */
"cookieslist": false, /* Show the cookie list */
"adblocker": false, /* Show a Warning if an adblocker is detected */
"AcceptAllCta" : true, /* Show the accept all button when highPrivacy on */
"highPrivacy": true, /* Disable auto consent */
"handleBrowserDNTRequest": true, /* If Do Not Track == 1, disallow all */
"removeCredit": false, /* Remove credit link */
"moreInfoLink": true, /* Show more info link */
"useExternalCss": true, /* If false, the tarteaucitron.css file will be loaded */
//"cookieDomain": ".my-multisite-domaine.fr", /* Shared cookie for multisite */
"readmoreLink": "/cookiespolicy" /* Change the default readmore link */
});
addclass();
mapsalles();
clickbutton();
clicksenddevis();
links();
slide();
filteritem();
map();
burger();
if ($('section').is("#nos-packs")) {
open_pack();
}
});