burger menu nav principal
This commit is contained in:
@@ -37,28 +37,40 @@ header[role=banner]{
|
||||
}
|
||||
@media (max-width:891px) {
|
||||
// width: 10%;
|
||||
padding-left: 5%;
|
||||
padding-left: 3%;
|
||||
padding-top: 0%;
|
||||
width: 80px;
|
||||
}
|
||||
}
|
||||
#block-reha-logoreha{
|
||||
grid-column: 2;
|
||||
height: $header-height;
|
||||
padding-left: 1rem;
|
||||
@media (max-width:891px) {
|
||||
height: fit-content;
|
||||
padding-left: 0;
|
||||
}
|
||||
.field--name-field-logo{
|
||||
height: $header-height;
|
||||
// height: $header-height;
|
||||
.field__item{
|
||||
height: $header-height;
|
||||
// height: $header-height;
|
||||
img{
|
||||
max-height: 92px;
|
||||
width: auto;
|
||||
@media (max-width:891px) {
|
||||
max-height: 60px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#block-reha-navigationprincipale {
|
||||
grid-column: 3 / span 6 ;
|
||||
@media (max-width:891px) {
|
||||
padding-left: 1rem;
|
||||
}
|
||||
ul{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@@ -66,7 +78,9 @@ header[role=banner]{
|
||||
|
||||
|
||||
@media (max-width:1100px) {
|
||||
flex-direction: column;
|
||||
// flex-direction: column;
|
||||
width: fit-content;
|
||||
|
||||
}
|
||||
li{
|
||||
&.has-active {
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
/* themes/custom/reha/assets/css/menu-burger-auto.css */
|
||||
.rb-sr {
|
||||
position:absolute !important; width:1px; height:1px; padding:0; margin:-1px;
|
||||
overflow:hidden; clip:rect(0,0,0,0); clip-path: inset(50%); white-space:nowrap; border:0;
|
||||
}
|
||||
|
||||
/* Bouton burger */
|
||||
.rb-toggle {
|
||||
display:inline-flex; align-items:center; justify-content:center;
|
||||
gap:.5rem; border:1px solid #ddd; background:#fff; color:#111;
|
||||
border-radius:.75rem; padding:.6rem .8rem; cursor:pointer;
|
||||
}
|
||||
|
||||
/* Icône */
|
||||
.rb-burger { display:inline-flex; flex-direction:column; gap:6px; }
|
||||
.rb-line { width:22px; height:2px; background:currentColor; display:block;
|
||||
transition: transform .2s ease, opacity .2s ease; }
|
||||
|
||||
/* Anim "X" */
|
||||
.rb-toggle.is-active .rb-line:nth-child(1){ transform: translateY(8px) rotate(45deg); }
|
||||
.rb-toggle.is-active .rb-line:nth-child(2){ opacity:0; }
|
||||
.rb-toggle.is-active .rb-line:nth-child(3){ transform: translateY(-8px) rotate(-45deg); }
|
||||
|
||||
/* Liste (mobile) */
|
||||
#main-nav.rb-list {
|
||||
list-style:none; padding:0; margin:.75rem 0 0 0; display:grid; gap:.25rem;
|
||||
}
|
||||
#main-nav.rb-list a {
|
||||
display:block; padding:.75rem 1rem; border-radius:.5rem; text-decoration:none;
|
||||
background:#fff; color:#111;
|
||||
}
|
||||
#main-nav.rb-list a:focus-visible { outline:2px solid #5b9aff; outline-offset:2px; }
|
||||
|
||||
/* Desktop / tablette */
|
||||
@media (min-width:768px){
|
||||
.rb-toggle{ display:none; }
|
||||
#main-nav.rb-list { display:flex; gap:.5rem; margin-top:0; }
|
||||
#main-nav.rb-list a { background:transparent; padding:.5rem .75rem; }
|
||||
#main-nav.rb-list a:hover { text-decoration: underline; }
|
||||
}
|
||||
|
||||
/* Impression : menu toujours visible */
|
||||
@media print {
|
||||
.rb-toggle{ display:none !important; }
|
||||
#main-nav.rb-list{ display:block !important; }
|
||||
}
|
||||
|
||||
/* 1) Garantir que l’attribut hidden cache bien l’élément,
|
||||
même si un autre CSS met un display:... */
|
||||
#main-nav[hidden] { display: none !important; }
|
||||
|
||||
/* 2) Fallback ultra simple : on cache le menu en mobile,
|
||||
et on l’affiche quand le bouton est actif.
|
||||
(Le JS insère le bouton juste AVANT le <ul>, donc l’adjacence fonctionne) */
|
||||
@media (max-width: 767px) {
|
||||
#main-nav.rb-list { display: none !important; }
|
||||
.rb-toggle.is-active + #main-nav.rb-list { display: grid !important; }
|
||||
}
|
||||
|
||||
|
||||
/* --- Empêcher le menu d'impacter la mise en page du header (mobile) --- */
|
||||
@media (max-width: 767.98px) {
|
||||
/* Le conteneur nav sert d'ancre pour le positionnement absolu */
|
||||
#block-reha-navigationprincipale {
|
||||
position: relative;
|
||||
overflow: visible; /* au cas où un parent a overflow:hidden */
|
||||
/* optionnel : si le header a text-align:center et que tu veux
|
||||
que le bouton reste à gauche, décommente la ligne suivante */
|
||||
/* text-align: initial; */
|
||||
}
|
||||
|
||||
/* Par défaut, menu masqué quand le bouton n'est pas actif */
|
||||
#block-reha-navigationprincipale .rb-toggle + #main-nav.rb-list {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Quand on ouvre: on montre le menu en position absolue, hors du flux */
|
||||
#block-reha-navigationprincipale .rb-toggle.is-active + #main-nav.rb-list {
|
||||
display: grid !important;
|
||||
}
|
||||
|
||||
/* Sortir le UL du flux et de tout align center, en overlay sous la barre */
|
||||
#block-reha-navigationprincipale #main-nav.rb-list {
|
||||
position: absolute;
|
||||
top: 100%; /* juste sous la barre de nav */
|
||||
left: 0;
|
||||
right: 0; /* pleine largeur du nav */
|
||||
z-index: 1000;
|
||||
text-align: left; /* ignore tout text-align:center parent */
|
||||
margin: 0;
|
||||
padding: .5rem;
|
||||
background: #fff;
|
||||
box-shadow: 0 8px 20px rgba(0,0,0,.15);
|
||||
}
|
||||
#block-reha-navigationprincipale #main-nav.rb-list a {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
/* --- Desktop : on remet le menu dans le flux normal --- */
|
||||
@media (min-width: 768px) {
|
||||
#block-reha-navigationprincipale #main-nav.rb-list {
|
||||
position: static;
|
||||
box-shadow: none;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user