@ -1,10 +1,16 @@
{{ define "styles"}}
{{ $customCSS := resources.Get "css/index.css" | resources.ToCSS }}
< link rel = "stylesheet" href = "{{ $customCSS.RelPermalink }}" >
< style >
.carousel-item {
position: absolute;
width: 100%;
}
< / style >
{{ end }}
{{ define "content" }}
< section class = "has-background-black is-fullheight" >
< section class = "has-background- danger ">
< div id = "galerie" class = "carousel" >
{{ $carouselImages := resources.Match "carousel/*"}}
{{ range $index, $image := $carouselImages }}
@ -20,7 +26,7 @@
{{- $webpm := $image.Resize (printf "%dx webp q%d picture" 1440 75) }}
{{- $webpl := $image.Resize (printf "%dx webp q%d picture" 1920 75) }}
{{- $webpxl := $image.Resize (printf "%dx webp q%d picture" 2560 75) }}
< figure class = "image ">
< figure class = "image carousel-item" style = "height: 100vh; ">
< picture >
< source type = "image/webp"
srcset="{{ $webpxxs.Permalink }} {{ $webpxxs.Width }}w,
@ -29,14 +35,15 @@
{{ $webpm.Permalink }} {{ $webpm.Width }}w,
{{ $webpl.Permalink }} {{ $webpl.Width }}w,
{{ $webpxl.Permalink }} {{ $webpl.Width }}w"
sizes="(max-with: 411x) 100vw,
(max-width: 767x) 412px,
sizes="(max-with: 411p x) 100vw,
(max-width: 767p x) 412px,
(max-width: 1023px) 768px,
(max-width: 1439px) 1024px,
(max-width: 1919px) 1440px,
(max-width: 2559px) 1920px,
2560px">
< img src = '{{ $jpegl.Permalink }}'
< img style = "width: 100%; height: 100%; object-fit: cover;"
src='{{ $jpegl.Permalink }}'
width="{{ $jpegxl.Width }}"
height="{{ $jpegxl.Height }}"
{{ if ne $index 0 }} loading="lazy" {{ end }}
@ -46,8 +53,8 @@
{{ $jpegm.Permalink }} {{ $jpegm.Width }}w,
{{ $jpegl.Permalink }} {{ $jpegl.Width }}w,
{{ $jpegxl.Permalink }} {{ $jpegxl.Width }}w"
sizes="(max-with: 411x) 100vw,
(max-width: 767x) 412px,
sizes="(max-with: 411p x) 100vw,
(max-width: 767p x) 412px,
(max-width: 1023px) 768px,
(max-width: 1439px) 1024px,
(max-width: 1919px) 1440px,
@ -61,11 +68,11 @@
< div id = "news" class = " m carousel box overlay">
< div id = "news" class = " news carousel box overlay">
{{ $spectacles := where .Site.RegularPages "Section" "spectacles" }}
{{ range $index, $page := where $spectacles ".Params.actu" "!=" nil }}
< div class = " m carousel-item text-center has-text-warning-light {{ if eq $index 0}}is-block {{ else }} is-hidden {{end}}">
< div class = "title py-3"> Actualités< / div >
< div class = " news carousel-item text-center has-text-warning-light {{ if eq $index 0}}is-block {{ else }} is-hidden {{end}}">
< div class = "title has-text-warning-light py-3"> Actualités< / div >
< div class = "subtitle has-text-warning-light" > {{ .Title }}< / div >
< p class = "p-0-mobile px-4-tablet" > {{ .Params.actu }}< / p >
< / div >
@ -77,10 +84,53 @@
{{ end }}
{{ define "scripts"}}
< script >
document.addEventListener('DOMContentLoaded', function() {
let currentIndex = 0;
const items = document.querySelectorAll('.mcarousel .mcarousel-item');
const items = document.querySelectorAll('.carousel-item');
const totalItems = items.length;
items.forEach((item, index) => {
if ( index !== 0 ) {
item.classList.add('is-invisible')
item.style.transform = "translateX(100%)";
} else {
item.classList.add('is-block')
};
item.style.transition = "transform 1s ease";
});
function moveToNextItem() {
currentIndex = (currentIndex + 1) % totalItems;
updateCarousel();
}
function updateCarousel() {
items.forEach((item, index) => {
if (index === currentIndex) {
item.classList.remove('is-invisible');
item.classList.add('is-block');
item.style.transform = "translateX(0)";
} else if (currentIndex === 0 & & index === totalItems - 1) {
item.style.transform = "translateX(-100%)";
} else if (index === currentIndex -1) {
item.style.transform = "translateX(-100%)";
} else {
item.classList.remove('is-block');
item.classList.add('is-invisible');
item.style.transform = "translateX(100%)";
}
})
}
setInterval(moveToNextItem, 2000);
});
< / script >
< script >
document.addEventListener('DOMContentLoaded', function() {
let currentIndex = 0;
const items = document.querySelectorAll('.newscarousel .newscarousel-item');
const totalItems = items.length;
function moveToNextItem() {
@ -98,27 +148,13 @@
}
});
}
const interval = 3 000; // 3000ms = 3 seconds
const interval = 5 000; // 3000ms = 3 seconds
setInterval(moveToNextItem, interval);
updateCarousel();
});
< / script >
< script >
bulmaCarousel.attach('#galerie', {
slidesToScroll: 1,
slidesToShow: 1,
navigation: false,
navigationKeys: false,
pagination: false,
loop: false,
infinite: true,
autoplay: true,
autoplaySpeed: 3000,
pauseOnHover: false,
duration: 300
});
< / script >
< script type = "application/ld+json" >
{
"@context": "http://schema.org",