ldc-legaulois/resources/js/pages/onepage.js
Jérémy Munsch 9b8fa09f77 multiple fix
2021-05-04 12:19:48 +02:00

135 lines
4.5 KiB
JavaScript
Vendored

jQuery(function () {
if (window._status_MESSAGE) {
let aTag = $(".statusMsg");
setTimeout(() => {
$('html,body').animate({ scrollTop: aTag.offset().top }, 'slow');
}, 2000)
}
// touch hack for hovers
// https://stackoverflow.com/questions/2851663/how-do-i-simulate-a-hover-with-a-touch-in-touch-enabled-browsers
$('.product-btn > a').on('touchstart touchend', function (e) {
$(this).children('.hover').toggleClass('display');
});
$('.recip').on('touchstart touchend', function (e) {
$(this).children('.recip-hover').toggleClass('display-flex');
});
$("#strat1").on("click", function(event) {
event.preventDefault();
$("html, body")
.stop()
.animate({ scrollTop: 0 }, "slow");
});
$("#strat2").on("click", function(event) {
event.preventDefault();
$("html, body")
.stop()
.animate({ scrollTop: $(".history").offset().top - 80 }, "slow");
});
$("#strat3").on("click", function(event) {
event.preventDefault();
$("html, body")
.stop()
.animate({ scrollTop: $(".productnl").offset().top - 130 }, "slow");
});
$("#strat4").on("click", function(event) {
event.preventDefault();
$("html, body")
.stop()
.animate({ scrollTop: $(".recipenl").offset().top - 50 }, "slow");
});
$("#strat5").on("click", function(event) {
event.preventDefault();
$("html, body")
.stop()
.animate({ scrollTop: $(".saganl").offset().top - 120 }, "slow");
});
$("#strat6").on("click", function(event) {
event.preventDefault();
$("html, body")
.stop()
.animate({ scrollTop: $(".contact").offset().top }, "slow");
});
for (let i = 1; i <= 3; i++) {
$(".gamme" + i).on("click", function(event) {
event.preventDefault();
});
}
$(".qualiteForm").on("click", function() {
if ($("#nos_produit").css("display") == "none") {
$("#nos_produit").show("fast");
$(".champPj").css("display", "block");
$(".qualiteForm i").addClass("active");
} else {
$("#nos_produit").hide("fast");
$(".champPj").css("display", "none");
$(".qualiteForm i").removeClass("active");
}
});
$(".owl-carousel").owlCarousel({
loop: true,
autoWidth: true,
margin: 25,
nav: true,
navText: ["", ""],
center: true,
responsive: {
500: {
stagePadding: 36,
items: 1
}
}
});
$(".fancybox-saga").fancybox({
scrolling: "no",
fitToView: true,
maxWidth: "90%",
arrows: true,
helpers: {
media: true,
overlay: {
locked: true
}
}
});
var yearBefore = "1850";
$("#slide-histoire").DrSlider({
width: 1366 * 4,
height: 760 * 4,
widthMobile : 600,
heightMobile: 1000,
showNavigation: true,
positionNavigation: "in-center-bottom",
navigationType: "circle",
classButtonNext: "homeSlider-next",
classButtonPrevious: "homeSlider-prev",
controlBackgroundColor: "#FFFFFF",
showProgress: false,
duration: 40000,
on_transition: false,
play_timer: true,
onChanged: function() {
var year = $(".slide.active").data("value");
$(".slide.active .content .date-history").html(year);
yearBefore = year;
$(".slide .content .date-history").each(function(index, el) {
$(this).html(yearBefore);
});
}
});
window.odometerOptions = {
auto: false, // Don't automatically initialize everything with class 'odometer'
selector: ".odometer", // Change the selector used to automatically find things to be animated
format: "d", // Change how digit groups are formatted, and how many digits are shown after the decimal point
duration: 2000, // Change how long the javascript expects the CSS animation to take
theme: "default", // Specify the theme (if you have more than one theme css file on the page)
animation: "count" // Count is a simpler animation method which just increments the value,
// use it when you're looking for something more subtle.
};
});