123 lines
3.7 KiB
JavaScript
123 lines
3.7 KiB
JavaScript
// Preloader js
|
|
$(window).on('load', function () {
|
|
$('.preloader').fadeOut(100);
|
|
});
|
|
|
|
(function ($) {
|
|
'use strict';
|
|
|
|
// navigation
|
|
$(window).scroll(function () {
|
|
if ($('.navigation').offset().top > 1) {
|
|
$('.navigation').addClass('nav-bg');
|
|
} else {
|
|
$('.navigation').removeClass('nav-bg');
|
|
}
|
|
});
|
|
|
|
|
|
// video modal popup
|
|
var $videoSrc;
|
|
$('.video-modal').click(function () {
|
|
$videoSrc = $(this).data("src");
|
|
});
|
|
$('#videoModal').on('shown.bs.modal', function (e) {
|
|
$("#video").attr('src', $videoSrc + "?autoplay=1&modestbranding=1&showinfo=0");
|
|
})
|
|
$('#videoModal').on('hide.bs.modal', function (e) {
|
|
$("#video").attr('src', $videoSrc);
|
|
})
|
|
$('#videoModal2').on('shown.bs.modal', function (e) {
|
|
$("#video2").attr('src', $videoSrc + "?autoplay=1&modestbranding=1&showinfo=0");
|
|
})
|
|
$('#videoModal2').on('hide.bs.modal', function (e) {
|
|
$("#video2").attr('src', $videoSrc);
|
|
})
|
|
|
|
|
|
// testimonial slider
|
|
$('.testimonial-slider').slick({
|
|
dots: false,
|
|
infinite: true,
|
|
speed: 300,
|
|
slidesToShow: 3,
|
|
slidesToScroll: 1,
|
|
arrows: true,
|
|
prevArrow: '<button type=\'button\' class=\'prevArrow\'><i class=\'ti-arrow-left\'></i></button>',
|
|
nextArrow: '<button type=\'button\' class=\'nextArrow\'><i class=\'ti-arrow-right\'></i></button>',
|
|
autoplay: true,
|
|
responsive: [{
|
|
breakpoint: 1024,
|
|
settings: {
|
|
slidesToShow: 3
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 600,
|
|
settings: {
|
|
slidesToShow: 2
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 401,
|
|
settings: {
|
|
slidesToShow: 1
|
|
}
|
|
}
|
|
]
|
|
});
|
|
|
|
|
|
// product Slider
|
|
$('.product-slider').slick({
|
|
autoplay: false,
|
|
infinite: true,
|
|
arrows: false,
|
|
dots: true,
|
|
customPaging: function (slider, i) {
|
|
var image = $(slider.$slides[i]).data('image');
|
|
return '<img class="img-fluid" src="' + image + '" alt="product-img">';
|
|
}
|
|
});
|
|
|
|
|
|
// Accordions
|
|
$('.collapse').on('shown.bs.collapse', function () {
|
|
$(this).parent().find('.ti-plus').removeClass('ti-plus').addClass('ti-minus');
|
|
}).on('hidden.bs.collapse', function () {
|
|
$(this).parent().find('.ti-minus').removeClass('ti-minus').addClass('ti-plus');
|
|
});
|
|
|
|
// Contact Form
|
|
$( document ).ready(function() {
|
|
var $contactForm = $('#contact-form');
|
|
$contactForm.submit(function(e) {
|
|
e.preventDefault();
|
|
$.ajax({
|
|
url: 'https://mailbear.delmar.bzh/api/v1/form/En7Bq5f4izuYs2zsnYHzmomNXbLzJE6V',
|
|
method: 'POST',
|
|
data: $(this).serialize(),
|
|
dataType: 'json',
|
|
beforeSend: function() {
|
|
$contactForm.find('.overlay div').html('<div class="alert alert--loading"><i class="fa fa-circle-o-notch fa-spin"></i> Envoi...</div>');
|
|
$contactForm.find('.overlay').fadeIn();
|
|
},
|
|
success: function(data) {
|
|
$contactForm.find('.alert--loading').hide();
|
|
$contactForm.find('.overlay div').html('<div class="alert alert--success"><i class="fa fa-check"></i> Message envoyé !</div>');
|
|
$contactForm.find('.overlay').fadeIn();
|
|
},
|
|
error: function(err) {
|
|
$contactForm.find('.alert--loading').hide();
|
|
$contactForm.find('.overlay div').html('<div class="alert alert--error"><i class="fa fa-warning"></i> Ooops, c\'est tout pêté !!!</div>');
|
|
$contactForm.find('.overlay').fadeIn();
|
|
}
|
|
});
|
|
});
|
|
$contactForm.find('.overlay').click(function(e) {
|
|
$(this).fadeOut();
|
|
});
|
|
});
|
|
|
|
})(jQuery);
|