carroussel actus home debugg css

This commit is contained in:
2025-03-13 14:19:44 +01:00
parent efe44ec52a
commit f4208a492e
8 changed files with 261 additions and 211 deletions

View File

@@ -0,0 +1,87 @@
/**
* @file
* quartiers_de_demain behaviors.
*/
(function (Drupal) {
'use strict';
Drupal.behaviors.quartiers_de_demain = {
attach: function (context, settings) {
console.log('It works!');
}
};
} (Drupal));
/////////////// start class à view-rows-ressources ////////
$(document).ready(function () {
$(".view-rows-wrapper").each(function () {
let h3Container = $(this).prev("h3").find("div[class^='type-']");
let classToAdd = h3Container.attr("class"); // Récupère la classe complète (ex: "type-Documentation")
if (classToAdd) {
$(this).addClass(classToAdd); // Ajoute cette classe à .view-rows-wrapper
}
});
});
////////////////// end class à view-rows-wrapper ////////////////
/////////////////// start voir plus... ressources ////////////////////
$(document).ready(function () {
// Vérifier si on est sur la page avec l'ID #ressources
if ($("#ressources").length > 0) {
$(".view-rows-wrapper").each(function () {
let container = $(this); // Cible uniquement cette section
let items = container.find(".views-row"); // Les éléments à afficher progressivement
let visibleCount = 4; // Nombre d'éléments visibles au départ
// Récupérer la classe `type-XXX`
let typeClass = container.attr("class").split(" ").find(cls => cls.startsWith("type-"));
let typeName = typeClass ? typeClass.replace("type-", "").replace(/-/g, " ") : "contenu"; // Nettoyer le nom
if (typeClass === "type-podcast" || typeClass === "type-video") {
visibleCount = 2; // Pour Podcast et Vidéo
}
// Ajouter un bouton dynamiquement après chaque `.view-rows-ressources`
let button = $("<button>")
.addClass("voir-plus")
.text("Voir plus de " + typeName)
.insertAfter(container);
// Cacher tous les éléments sauf les 4 premiers
items.hide().slice(0, visibleCount).show();
// Action sur le bouton
button.on("click", function () {
let hiddenItems = container.find(".views-row:hidden").slice(0, 4); // Prochains éléments à afficher
if ($(this).text().includes("Voir plus")) {
hiddenItems.slideDown(); // Afficher avec un effet de glissement
if (container.find(".views-row:hidden").length === 0) {
$(this).text("Voir moins de " + typeName); // Changer le texte du bouton si tout est affiché
}
} else {
container.find(".views-row").slice(visibleCount).slideUp(); // Replier les éléments
$(this).text("Voir plus de " + typeName); // Revenir à l'état initial
}
});
});
}
});
/////////////////// end voir plus... ressources ////////////////////

View File

@@ -696,6 +696,8 @@ $(document).ready(function () {
});
////////////////// end class à view-rows-wrapper ////////////////
/////////////////// start voir plus... ressources ////////////////////
$(document).ready(function () {
@@ -743,8 +745,6 @@ $(document).ready(function () {
}
});
/////////////////// end voir plus... ressources ////////////////////

View File

@@ -46,10 +46,10 @@
.node-type-actualite{
width: 100%;
padding-bottom: 7rem;
a{
display: flex;
flex-direction: column;
}
// a{
// display: flex;
// flex-direction: column;
// }
.infos-actu{
order: 1;
@@ -57,7 +57,7 @@
flex-direction: row;
padding: 1rem 0rem;
margin-bottom: 1rem;
.field_field_type_d_actualite a{
.field_field_type_d_actualite{
text-transform: uppercase;
color: red;
font-size: 0.6rem;
@@ -81,6 +81,7 @@
}
}
.field_body {
order: 2;
padding-bottom: 2rem;
@@ -114,9 +115,9 @@
}
}
a:not(.ext){
display: none;
}
// a:not(.ext){
// display: none;
// }
}
.field_field_images{

View File

@@ -42,156 +42,142 @@
padding-top: 3rem;
}
article.node-type-actualite{
a{
display: flex;
flex-direction: column;
h2{
display: none;
}
.field_field_images{
order: 1;
background-color: black;
-moz-border-radius: 9px; /* pour Mozilla */
-khtml-border-radius: 9px; /* pour Safari et Chrome */
-webkit-border-radius: 9px; /* pour Safari sur Mac */
border-radius: 9px; /* CSS3 */
height: 250px;
margin-bottom: 0.6rem;
@media(max-width: 550px){
height: 170px;
}
div{
height: 100%;
div{
// height: 600px;
a{
display: block;
height: 100%;
img{
width: 100%;
height: 100%;
object-fit: cover;
-moz-border-radius: 9px; /* pour Mozilla */
-khtml-border-radius: 9px; /* pour Safari et Chrome */
-webkit-border-radius: 9px; /* pour Safari sur Mac */
border-radius: 9px; /* CSS3 */
@media(max-width: 550px){
max-height: 170px;
}
}
}
}
}
img{
width: 100%;
height: 100%;
object-fit: cover;
div{
display: flex;
flex-direction: column;
align-items: flex-start;
.field_field_images{
order: 1;
background-color: black;
-moz-border-radius: 9px; /* pour Mozilla */
-khtml-border-radius: 9px; /* pour Safari et Chrome */
-webkit-border-radius: 9px; /* pour Safari sur Mac */
border-radius: 9px; /* CSS3 */
height: 250px;
width: 100%;
margin-bottom: 0.6rem;
@media(max-width: 550px){
max-height: 170px;
height: 170px;
}
div.cadre-img-zoom{
height: 100%;
display: block;
height: 100%;
img{
width: 100%;
height: 100%;
object-fit: cover;
-moz-border-radius: 9px; /* pour Mozilla */
-khtml-border-radius: 9px; /* pour Safari et Chrome */
-webkit-border-radius: 9px; /* pour Safari sur Mac */
border-radius: 9px; /* CSS3 */
@media(max-width: 550px){
max-height: 170px;
}
}
}
}
.field_field_type_d_actualite{
order: 2;
text-transform: uppercase;
color: red;
font-size: 0.5rem;
font-family: 'gilroy-bold';
display: inline-flex;
flex-direction: row;
align-items: center;
&::before{
content: url('../img/type-actu.svg');
padding-right: 0.3rem;
padding-bottom: 0.2rem;
}
a{color: red;}
}
// .infos-actu{
// order: 2;
// h2{
// font-family: 'gilroy-semibold';
// }
// }
.field_field_date{
order: 3;
color: red;
display: inline-flex;
flex-direction: row;
align-items: center;
font-size: 0.5rem;
font-family: 'gilroy-bold';
&::before{
content: url('../img/date-actu.svg');
padding-right: 0.3rem;
}
}
}
.field_field_type_d_actualite{
text-transform: uppercase;
color: red;
font-size: 0.5rem;
font-family: 'gilroy-bold';
display: inline-flex;
align-items: center;
&::before{
content: url('../img/type-actu.svg');
padding-right: 0.3rem;
padding-bottom: 0.2rem;
.field_title{
order: 4;
padding-top: 0.2rem;
h2{
margin: 0;
line-height: 0.4;
padding-bottom: 0.6rem;
padding-left: 0;
a{
font-size: 0.8rem;
color: $blue_QDD;
}
}
}
}
.infos-actu{
order: 2;
h2{
font-family: 'gilroy-semibold';
}
}
.field_field_date{
color: red;
display: inline-flex;
align-items: center;
font-size: 0.5rem;
font-family: 'gilroy-bold';
&::before{
content: url('../img/date-actu.svg');
padding-right: 0.3rem;
}
}
.field_title{
order: 3;
padding-top: 0.2rem;
h2{
margin: 0;
line-height: 0.4;
padding-bottom: 0.6rem;
.field_body{
order: 5;
// visibility: visible;
opacity: 1 !important;
transform: none !important;
font-family: 'gilroy-regular';
p{
margin: 0;
margin-bottom: 1rem;
font-size: 0.7rem ;
}
a{
font-size: 0.8rem;
color: $blue_QDD;
}
}
}
.field_body{
order: 4;
// visibility: visible;
opacity: 1 !important;
transform: none !important;
font-family: 'gilroy-regular';
p{
margin: 0;
margin-bottom: 1rem;
font-size: 0.7rem ;
}
a{
color: $blue_QDD;
}
}
.field_field_liens{
order: 5;
width: fit-content;
padding-left: 0.5rem;
// padding-bottom: 0.2rem;
// padding-top: 0.2rem;
background: black;
@media (max-width:810px) {
margin-left: 0;
}
.field_field_liens{
order: 6;
width: fit-content;
padding-left: 0.5rem;
// padding-bottom: 0.2rem;
// padding-top: 0.2rem;
background: black;
@media (max-width:810px) {
margin-left: 0;
}
a{
display: inline-flex;
align-items: center;
color: white;
text-transform: uppercase;
font-size: 0.6rem;
svg{
display: none;
}
&::after{
a{
display: inline-flex;
content: url("../img/noun-arrow-to-right.svg");
padding-right: 0.2rem;
padding-left: 0.2rem;
// padding-bottom: 0.2rem;
}
}
align-items: center;
color: white;
text-transform: uppercase;
font-size: 0.6rem;
svg{
display: none;
}
&::after{
display: inline-flex;
content: url("../img/noun-arrow-to-right.svg");
padding-right: 0.2rem;
padding-left: 0.2rem;
// padding-bottom: 0.2rem;
}
}
}
}
}
}
}
.views-row:nth-child(odd){