ldc-jeusselin/resources/js/main.js

150 lines
5.5 KiB
JavaScript
Vendored

require('@fortawesome/fontawesome-free/js/all');
import Swiper from 'swiper/swiper-bundle';
require('./bootstrap');
require('@fancyapps/fancybox');
$(document).ready(function() {
// HEADER
// GESTION RESPONSIVE DU MENU
$('.toggle-menu').click(function(){
$(this).toggleClass('active');
$('nav').toggleClass('active')
$('body').toggleClass('mobile-nav-active');
})
$('header .disconnect, header .mobile-disconnect').click(function(e){
e.preventDefault();
$(this).removeClass('logged');
$('header .connect-contain p').removeClass('logged')
// $('header .connect').removeClass('account')
})
// BORDER VISIBLE SUR LE MENU AFFICHE
$('nav ul li').click(function() {
$(this).toggleClass('active');
})
// HOME PAGE
// SLIDER
//initialize swiper when document ready
const mySwiper = new Swiper ('.swiper-container', {
speed: 2000,
parallax: true,
effect: 'slide',
slidesPerView: 1,
autoplay: {
delay: 1000,
},
loop: true,
pagination: {
el: '.swiper-pagination',
type: 'bullets',
clickable: true,
},
});
// Section VIDEO
$('.screenplay').click(function(e) {
e.preventDefault();
$(this).siblings().removeClass('active')
$(this).toggleClass('active');
// $('.popup-detail').addClass('active');
if ($(this)[0].classList[1]) {
switch ($(this)[0].classList[1]) {
case "marolles":
$('.player-bloc.wide iframe').attr("src", "https://player.vimeo.com/video/510307128?autoplay=1")
break;
case "cherre":
$('.player-bloc.wide iframe').attr("src", "https://player.vimeo.com/video/510306947?autoplay=1")
break;
case "monce":
$('.player-bloc.wide iframe').attr("src", "https://player.vimeo.com/video/510307183?autoplay=1")
break;
case "nogent-le-bernard":
$('.player-bloc.wide iframe').attr("src", "https://player.vimeo.com/video/510306862?autoplay=1")
break;
case "mamers":
$('.player-bloc.wide iframe').attr("src", "https://player.vimeo.com/video/510307063?autoplay=1")
break;
case "thoigne-les-mees":
$('.player-bloc.wide iframe').attr("src", "https://player.vimeo.com/video/510306899?autoplay=1")
break;
default:
$('.player-bloc.wide iframe').attr("src", "https://player.vimeo.com/video/510306998?autoplay=1")
break;
}
}
})
// PAGE "QUI SOMMES NOUS"
// AFFICHAGE DU DETAIL DE LA CHRONOLOGIE
$('.frise .event').click(function() {
$('body .bg-opacity').addClass('active');
$('.popup-detail').addClass('active');
})
$('.frise #close-cross').click(function() {
$('body .bg-opacity').removeClass('active');
$('.popup-detail').removeClass('active');
})
// PAGE "NOUS CONTACTER"
// ON CACHE LA POPUP D'INFO
$('.choice--btn').click(function() {
$('body .bg-opacity').removeClass('active');
$('.popup-choice').addClass('hidden');
})
// PAGE "COLLECTE"
$('.collect--row .bloc--btn').click(function(e) {
// e.preventDefault();
if ($(this)[0].classList[1]) {
$( "#collect--map" ).fadeOut(0).fadeIn(500);
$('#collect--map').empty();
switch ($(this)[0].classList[1]) {
case "marolles":
$('#collect--map').append('<iframe width="100%" height="450" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?q=marolles-les-brault%20jeusselin&amp;z=17&amp;ie=UTF8&amp;iwloc=B&amp;output=embed"></iframe>');
break;
case "cherre":
$('#collect--map').append('<iframe width="100%" height="450" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?q=cherr%C3%A9%20jeusselin&amp;z=17&amp;ie=UTF8&amp;iwloc=B&amp;output=embed"></iframe>');
break;
case "monce":
$('#collect--map').append('<iframe width="100%" height="450" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?q=monc%C3%A9%20en%20saosnois%20jeusselin&amp;z=17&amp;ie=UTF8&amp;iwloc=B&amp;output=embed"></iframe>');
break;
// case "nogent-le-bernard":
// $('#collect--map').append('');
// break;
case "mamers":
$('#collect--map').append('<iframe width="100%" height="450" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?q=mamers%20jeusselin&amp;z=17&amp;ie=UTF8&amp;iwloc=B&amp;output=embed"></iframe>');
break;
// case "thoigne-les-mees":
// $('#collect--map').append('');
// break;
// case "les-mees":
// $('#collect--map').append('');
// break;
// case "sille-le-guillaume":
// $('#collect--map').append('');
// break;
default:
$('#collect--map').append('<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m12!1m3!1d120205.41598827539!2d0.26861220027133315!3d48.26072718402679!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!5e0!3m2!1sfr!2sfr!4v1613659020066!5m2!1sfr!2sfr" width="100%" height="450" frameborder="0" style="border:0;" allowfullscreen="" aria-hidden="false" tabindex="0"></iframe>');
break;
}
}
})
// FOOTER
// MENU TOUJOURS PRESENT
$(window).on('scroll',function() {
if($(window).scrollTop()) {
$('header').addClass('sticky-bar')
$('.pageup').addClass('see')
}
else {
$('header').removeClass('sticky-bar')
$('.pageup').removeClass('see')
}
})
});