@media caroussel ressouce image
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
@@ -5882,6 +5882,11 @@ svg.ext {
|
|||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@media screen and (max-width: 810px) {
|
||||||
|
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block {
|
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
@@ -6007,9 +6012,65 @@ svg.ext {
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
@media screen and (max-width: 810px) {
|
||||||
|
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block-entity-fieldnodefield-images .carousel {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2rem;
|
||||||
|
align-items: center;
|
||||||
|
width: 100vw;
|
||||||
|
}
|
||||||
|
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block-entity-fieldnodefield-images .carousel .main-image-block {
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block-entity-fieldnodefield-images .thumbnails-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
display: flex !important;
|
||||||
|
flex-direction: row !important; /* 👈 corrige l'orientation */
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
max-height: none;
|
||||||
|
padding: 1rem 0;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block-entity-fieldnodefield-images .thumbnails {
|
||||||
|
display: flex !important;
|
||||||
|
flex-direction: row !important; /* 👈 force l'alignement horizontal */
|
||||||
|
gap: 0.8 rem !important;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
padding: 0 1rem;
|
||||||
|
max-width: 100%;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block-entity-fieldnodefield-images .thumbnails::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block-entity-fieldnodefield-images .thumbnails img {
|
||||||
|
width: 60px;
|
||||||
|
height: 45px;
|
||||||
|
flex-shrink: 0; /* évite l’écrasement */
|
||||||
|
}
|
||||||
|
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block-entity-fieldnodefield-images .thumb-arrow {
|
||||||
|
display: none; /* inutile si scroll horizontal */
|
||||||
|
}
|
||||||
|
}
|
||||||
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block-entity-fieldnodefield-images .field__items {
|
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block-entity-fieldnodefield-images .field__items {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
@media screen and (max-width: 810px) {
|
||||||
|
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block-entity-fieldnodefield-type-de-ressource,
|
||||||
|
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block-entity-fieldnodetitle,
|
||||||
|
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block-entity-fieldnodefield-edition,
|
||||||
|
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block-entity-fieldnodefield-auteur-s-,
|
||||||
|
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block-entity-fieldnodefield-date-de-parution,
|
||||||
|
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block-entity-fieldnodefield-mots-clefs {
|
||||||
|
margin-left: 7%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
body.type-media-reportage-photos .block-region-third .block-entity-fieldnodefield-projets-liee {
|
body.type-media-reportage-photos .block-region-third .block-entity-fieldnodefield-projets-liee {
|
||||||
transform: translateY(-45.5rem);
|
transform: translateY(-45.5rem);
|
||||||
|
|||||||
@@ -209,6 +209,24 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
|
|
||||||
function initCarousel({ mainImage, prevArrow, nextArrow, caption, thumbsContainer }) {
|
function initCarousel({ mainImage, prevArrow, nextArrow, caption, thumbsContainer }) {
|
||||||
const images = [];
|
const images = [];
|
||||||
|
// Adapter l'orientation des vignettes si écran < 810px
|
||||||
|
function applyResponsiveThumbnailsLayout() {
|
||||||
|
if (window.innerWidth < 810) {
|
||||||
|
thumbsContainer.style.flexDirection = 'row';
|
||||||
|
thumbsContainer.style.flexWrap = 'nowrap';
|
||||||
|
thumbsContainer.style.overflowX = 'auto';
|
||||||
|
thumbsContainer.style.overflowY = 'hidden';
|
||||||
|
thumbsContainer.style.display = 'flex';
|
||||||
|
thumbsContainer.style.justifyContent = 'center';
|
||||||
|
} else {
|
||||||
|
thumbsContainer.style.flexDirection = 'column';
|
||||||
|
thumbsContainer.style.overflowY = 'auto';
|
||||||
|
thumbsContainer.style.overflowX = 'hidden';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
applyResponsiveThumbnailsLayout();
|
||||||
|
window.addEventListener('resize', applyResponsiveThumbnailsLayout);
|
||||||
|
|
||||||
document.querySelectorAll('.carousel-items .carousel-item img').forEach((img) => {
|
document.querySelectorAll('.carousel-items .carousel-item img').forEach((img) => {
|
||||||
images.push({
|
images.push({
|
||||||
src: img.getAttribute('src'),
|
src: img.getAttribute('src'),
|
||||||
@@ -220,18 +238,42 @@ function initCarousel({ mainImage, prevArrow, nextArrow, caption, thumbsContaine
|
|||||||
|
|
||||||
let currentIndex = 0;
|
let currentIndex = 0;
|
||||||
|
|
||||||
|
// function scrollThumbnailToCenter(index) {
|
||||||
|
// const thumbnails = document.querySelectorAll('.thumbnails img');
|
||||||
|
// const activeThumb = thumbnails[index];
|
||||||
|
// if (activeThumb && thumbsContainer) {
|
||||||
|
// const containerHeight = thumbsContainer.clientHeight;
|
||||||
|
// const thumbOffsetTop = activeThumb.offsetTop;
|
||||||
|
// const thumbHeight = activeThumb.offsetHeight;
|
||||||
|
// const scrollTarget = thumbOffsetTop - (containerHeight / 2) + (thumbHeight / 2);
|
||||||
|
// thumbsContainer.scrollTo({ top: scrollTarget, behavior: 'smooth' });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
function scrollThumbnailToCenter(index) {
|
function scrollThumbnailToCenter(index) {
|
||||||
const thumbnails = document.querySelectorAll('.thumbnails img');
|
const thumbnails = document.querySelectorAll('.thumbnails img');
|
||||||
const activeThumb = thumbnails[index];
|
const activeThumb = thumbnails[index];
|
||||||
if (activeThumb && thumbsContainer) {
|
if (activeThumb && thumbsContainer) {
|
||||||
const containerHeight = thumbsContainer.clientHeight;
|
const isMobile = window.innerWidth < 810;
|
||||||
const thumbOffsetTop = activeThumb.offsetTop;
|
|
||||||
const thumbHeight = activeThumb.offsetHeight;
|
if (isMobile) {
|
||||||
const scrollTarget = thumbOffsetTop - (containerHeight / 2) + (thumbHeight / 2);
|
// Scroll horizontal
|
||||||
thumbsContainer.scrollTo({ top: scrollTarget, behavior: 'smooth' });
|
const containerWidth = thumbsContainer.clientWidth;
|
||||||
|
const thumbOffsetLeft = activeThumb.offsetLeft;
|
||||||
|
const thumbWidth = activeThumb.offsetWidth;
|
||||||
|
const scrollTarget = thumbOffsetLeft - (containerWidth / 2) + (thumbWidth / 2);
|
||||||
|
thumbsContainer.scrollTo({ left: scrollTarget, behavior: 'smooth' });
|
||||||
|
} else {
|
||||||
|
// Scroll vertical
|
||||||
|
const containerHeight = thumbsContainer.clientHeight;
|
||||||
|
const thumbOffsetTop = activeThumb.offsetTop;
|
||||||
|
const thumbHeight = activeThumb.offsetHeight;
|
||||||
|
const scrollTarget = thumbOffsetTop - (containerHeight / 2) + (thumbHeight / 2);
|
||||||
|
thumbsContainer.scrollTo({ top: scrollTarget, behavior: 'smooth' });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function showImage(index) {
|
function showImage(index) {
|
||||||
mainImage.src = images[index].src;
|
mainImage.src = images[index].src;
|
||||||
caption.textContent = images[index].caption;
|
caption.textContent = images[index].caption;
|
||||||
|
|||||||
@@ -8,6 +8,9 @@
|
|||||||
@media screen and (min-width:1100px) {
|
@media screen and (min-width:1100px) {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
@media screen and (max-width: 810px) {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
.block {
|
.block {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
@@ -176,12 +179,75 @@
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@media screen and (max-width: 810px) {
|
||||||
|
.carousel {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2rem;
|
||||||
|
align-items: center;
|
||||||
|
width: 100vw;
|
||||||
|
.main-image-block{
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.thumbnails-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
display: flex !important;
|
||||||
|
flex-direction: row !important; /* 👈 corrige l'orientation */
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
max-height: none;
|
||||||
|
padding: 1rem 0;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thumbnails {
|
||||||
|
display: flex !important;
|
||||||
|
flex-direction: row !important; /* 👈 force l'alignement horizontal */
|
||||||
|
gap: 0.8 rem !important;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
padding: 0 1rem;
|
||||||
|
max-width: 100%;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 60px;
|
||||||
|
height: 45px;
|
||||||
|
flex-shrink: 0; /* évite l’écrasement */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.thumb-arrow {
|
||||||
|
display: none; /* inutile si scroll horizontal */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Masquer les images Drupal originales (facultatif)
|
// Masquer les images Drupal originales (facultatif)
|
||||||
.field__items {
|
.field__items {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.block-entity-fieldnodefield-type-de-ressource,
|
||||||
|
.block-entity-fieldnodetitle,
|
||||||
|
.block-entity-fieldnodefield-edition,
|
||||||
|
.block-entity-fieldnodefield-auteur-s-,
|
||||||
|
.block-entity-fieldnodefield-date-de-parution,
|
||||||
|
.block-entity-fieldnodefield-mots-clefs{
|
||||||
|
@media screen and (max-width: 810px) {
|
||||||
|
margin-left: 7%;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user