Bladeren bron

amélioration dropdown collectif et debug (?) la nav au resize

Valentin 5 maanden geleden
bovenliggende
commit
c6186a58f4

+ 3 - 0
user/themes/figureslibres-v2/css/theme.css

@@ -200,6 +200,7 @@ h4 + p em > img.open {
 
 h4 + p + p {
   margin-bottom: 0 !important;
+  line-height: 1.45em;
   padding-bottom: 0rem;
   font-size: 0.75em;
   max-height: 0px;
@@ -360,6 +361,8 @@ body main .content .projet-card .loader {
 }
 body main .content .projet-card a {
   width: 100%;
+  display: flex;
+  justify-content: center;
 }
 body main .content .projet-card a figcaption {
   color: #0e1229;

File diff suppressed because it is too large
+ 0 - 0
user/themes/figureslibres-v2/css/theme.css.map


+ 16 - 4
user/themes/figureslibres-v2/js/script.js

@@ -77,6 +77,7 @@ function initBarba() {
     }
   })
   barba.hooks.after((data) => {
+    refreshUiOnResize()
     let pageTitleComparator, navIndex
     switch ($('main').children(":first").attr('id')) {
       case 'index-content':
@@ -175,9 +176,11 @@ function refreshUiOnResize() {
     if (result) {
       currentColor = $('body').css('background-color')
       if (isDesktopDevice) {
+        console.log("is desktop");
         $('nav').css('background-color', currentColor)
         $('#nav-container').css('background-color', color_bg)
       } else {
+        console.log("is NOT desktop");
         $('nav').css('background-color', color_main)
         $('#nav-container').css('background-color', currentColor)
       }
@@ -826,11 +829,20 @@ function addToggleBiography() {
 }
 
 function toggleBiographie(el) {
+  let targetContent;
+  let targetArrow;
   if (el.target.tagName === "H4") {
-    el.target.nextElementSibling.nextElementSibling.classList.toggle('open');
-    el.target.nextElementSibling.firstElementChild.firstElementChild.classList.toggle('open');
+    targetContent = el.target.nextElementSibling.nextElementSibling;
+    targetArrow = el.target.nextElementSibling.firstElementChild.firstElementChild;
   } else {
-    el.target.firstElementChild.classList.toggle('open');
-    el.target.parentElement.nextElementSibling.classList.toggle('open');
+    targetContent = el.target.firstElementChild;
+    targetArrow = el.target.parentElement.nextElementSibling;
+  }
+  for (let openElement of document.querySelectorAll('h4 + p > em > img, h4 + p + p')) {
+    if (openElement !== targetContent && openElement !== targetArrow) {
+      openElement.classList.remove('open');
+    }
   }
+  targetContent.classList.toggle('open');
+  targetArrow.classList.toggle('open');
 }

+ 2 - 0
user/themes/figureslibres-v2/scss/configuration/_variable.scss

@@ -34,8 +34,10 @@
 // typography - general sizes
   $currentSize: 1.2em;
   $smallSize: 0.95em;
+
   $tinySize: 0.75em;
   $currentLineHeight: 1.25em;
+  $smallFontLineHeight: 1.45em;
   $titleLineHeight: 1.1em;
 // typography - sizes mobile
   $titleFontSizeMobile: 1.8em;

+ 3 - 0
user/themes/figureslibres-v2/scss/style.scss

@@ -51,6 +51,7 @@
   }
   h4 + p + p {
     margin-bottom: 0 !important;
+    line-height: $smallFontLineHeight;
     padding-bottom: 0rem;
     font-size: $tinySize;
     max-height: 0px;
@@ -203,6 +204,8 @@
           }
           a {
             width: 100%;
+            display: flex;
+            justify-content: center;
             figcaption {  
                 color: $mainColor;
                 background-color: transparent;

Some files were not shown because too many files changed in this diff