feat: responsive style

This commit is contained in:
MrRaph_
2025-05-23 16:18:09 +00:00
parent 202a1469b8
commit 54be7b7455
2 changed files with 27 additions and 31 deletions

View File

@@ -1,69 +1,71 @@
/* css/style.css */ /* css/style.css */
/* -------------------------------------------------- */
/* Corrige le comportement “flex” sur mobile/tablette */
/* -------------------------------------------------- */
.e-con-inner {
display: block !important;
}
/* —————————————————————————————————————————— */ /* —————————————————————————————————————————— */
/* ZONES GLOBALES (overlay, cartes, images…) */ /* 0) Cartes, overlay et images */
/* —————————————————————————————————————————— */ /* —————————————————————————————————————————— */
/* 0) Cartes en conteneur relatif */
.elementor-category-grid .category-card { .elementor-category-grid .category-card {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
/* ratio fixe 5:2 */
height: 0; height: 0;
padding-bottom: 40%; /* ratio 5:2 */ padding-bottom: 40%;
} }
/* overlay via pseudo-élément */
.elementor-category-grid .category-card::before { .elementor-category-grid .category-card::before {
content: ""; content: "";
position: absolute; position: absolute;
top: 0; right: 0; bottom: 0; left: 0; inset: 0;
background-color: transparent; background-color: transparent;
transition: opacity .3s ease; transition: opacity .3s ease;
pointer-events: none; pointer-events: none;
} }
/* images pleines cartes */
.elementor-category-grid .category-card img { .elementor-category-grid .category-card img {
position: absolute; position: absolute;
top: 0; left: 0; inset: 0;
width: 100%; height: 100%; width: 100%;
height: 100%;
object-fit: cover; object-fit: cover;
transition: transform .4s ease; transition: transform .4s ease;
} }
/* zoom au hover */
.elementor-category-grid .category-card:hover img { .elementor-category-grid .category-card:hover img {
transform: scale(1.05); transform: scale(1.05);
} }
/* titre centré */
.elementor-category-grid .category-card-name { .elementor-category-grid .category-card-name {
position: absolute; position: absolute;
top: 50%; left: 50%; top: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
margin: 0;
padding: .5em 1em; padding: .5em 1em;
font-size: 1.5rem; font-size: 1.5rem;
line-height: 1.2; line-height: 1.2;
text-align: center; text-align: center;
color: #ffffff; color: #fff;
white-space: pre-wrap; white-space: pre-wrap;
word-break: break-word; word-break: break-word;
transition: font-size .3s ease, padding .3s ease; transition: font-size .3s ease, padding .3s ease;
} }
/* —————————————————————————————————————————— */ /* —————————————————————————————————————————— */
/* DISPOSITION DE LA GRILLE */ /* 1) Grille responsive par défaut (desktop) */
/* —————————————————————————————————————————— */ /* —————————————————————————————————————————— */
/* 1) Par défaut : auto-fit (desktop) */
.elementor-category-grid { .elementor-category-grid {
display: grid; display: grid;
gap: 1rem; gap: 1rem;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* auto-fit avec min 150px : plusieurs tuiles même sur petits écrans */
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
} }
/* 2) Mobile (≤ 480px) → 1 colonne forcée */ /* —————————————————————————————————————————— */
/* 2) Mobile (≤ 480px) → 1 colonne */
/* —————————————————————————————————————————— */
@media screen and (max-width: 480px) { @media screen and (max-width: 480px) {
.elementor-category-grid { .elementor-category-grid {
grid-template-columns: repeat(1, 1fr) !important; grid-template-columns: repeat(1, 1fr) !important;
@@ -74,7 +76,9 @@
} }
} }
/* 3) Tablette (481px768px) → 2 colonnes */ /* —————————————————————————————————————————— */
/* 3) Tablette (481px768px) → 2 colonnes fixes */
/* —————————————————————————————————————————— */
@media screen and (min-width: 481px) and (max-width: 768px) { @media screen and (min-width: 481px) and (max-width: 768px) {
.elementor-category-grid { .elementor-category-grid {
grid-template-columns: repeat(2, 1fr) !important; grid-template-columns: repeat(2, 1fr) !important;
@@ -84,7 +88,9 @@
} }
} }
/* 4) Desktop (≥ 769px) → respect des classes columns-X */ /* —————————————————————————————————————————— */
/* 4) Desktop (≥ 769px) → respect des classes */
/* —————————————————————————————————————————— */
@media screen and (min-width: 769px) { @media screen and (min-width: 769px) {
.elementor-category-grid.columns-1 { grid-template-columns: repeat(1, 1fr); } .elementor-category-grid.columns-1 { grid-template-columns: repeat(1, 1fr); }
.elementor-category-grid.columns-2 { grid-template-columns: repeat(2, 1fr); } .elementor-category-grid.columns-2 { grid-template-columns: repeat(2, 1fr); }

View File

@@ -453,17 +453,7 @@ class Elementor_Category_Grid_Widget extends \Elementor\Widget_Base
// Déterminer les catégories à afficher (inclure les sous-catégories si demandé). // Déterminer les catégories à afficher (inclure les sous-catégories si demandé).
$category_ids_to_show = $selected_ids; $category_ids_to_show = $selected_ids;
// if (!empty($settings['show_subcategories']) && $settings['show_subcategories'] === 'yes') {
// // Ajouter les sous-catégories de chaque catégorie sélectionnée.
// foreach ($selected_ids as $cat_id) {
// $child_ids = get_term_children($cat_id, 'category');
// if (is_array($child_ids) && !empty($child_ids)) {
// $category_ids_to_show = array_merge($category_ids_to_show, $child_ids);
// }
// }
// // Éliminer les doublons d'ID au cas où.
// $category_ids_to_show = array_unique($category_ids_to_show);
// }
// 1) Cas : on veut les sous-catégories de la page actuelle // 1) Cas : on veut les sous-catégories de la page actuelle
if ('yes' === $settings['subcats_of_current']) { if ('yes' === $settings['subcats_of_current']) {
$queried = get_queried_object(); $queried = get_queried_object();