From 1c39b1bd4d5d21edfe32229e64c3f4e49b0ab48a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= <jan.bednarik@gmail.com>
Date: Tue, 18 May 2021 12:04:09 +0200
Subject: [PATCH] elections2021: Program points fix faq

---
 .../elections2021/_floating_navigation.html      |  2 +-
 .../templates/elections2021/_question_block.html |  2 +-
 .../elections2021_program_point_page.html        | 16 +++++++++++++++-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/elections2021/templates/elections2021/_floating_navigation.html b/elections2021/templates/elections2021/_floating_navigation.html
index df92cdf3..0875f0f7 100644
--- a/elections2021/templates/elections2021/_floating_navigation.html
+++ b/elections2021/templates/elections2021/_floating_navigation.html
@@ -1,4 +1,4 @@
-<div class="floating-nav-wrapper hidden lg:block" id="floatingNavBarWrapper">
+<div class="floating-nav-wrapper hidden xl:block" id="floatingNavBarWrapper">
   <div class="floating-nav-panel " id="floatingNavBar">
     <div class="opener py-6 pb-16 px-11 bg-acidgreen text-white font-alt">
       RYCHLÁ NAVIGACE
diff --git a/elections2021/templates/elections2021/_question_block.html b/elections2021/templates/elections2021/_question_block.html
index 0aa83c73..78783cf7 100644
--- a/elections2021/templates/elections2021/_question_block.html
+++ b/elections2021/templates/elections2021/_question_block.html
@@ -4,7 +4,7 @@
     <h3 class="accordeon-row-heading head-alt-xs">{{ block.value.question }}</h3>
     <i class="ico--chevron-down"></i>
   </div>
-  <div class="accordeon-row-body" style="max-height: 216px;">
+  <div class="accordeon-row-body accordeon-row-body--classic">
     <div>
       <p>{{ block.value.answer|richtext|format_sources }}</p>
     </div>
diff --git a/elections2021/templates/elections2021/elections2021_program_point_page.html b/elections2021/templates/elections2021/elections2021_program_point_page.html
index 642d6fec..e62d808a 100644
--- a/elections2021/templates/elections2021/elections2021_program_point_page.html
+++ b/elections2021/templates/elections2021/elections2021_program_point_page.html
@@ -5,7 +5,7 @@
 <div class="container container-default pt-4 pb-20">
   <div class="w-full lg:w-4/6 relative container-collapsible">
 
-    <div class="floating-nav-wrapper hidden lg:block" id="floatingNavBarWrapper">
+    <div class="floating-nav-wrapper hidden xl:block" id="floatingNavBarWrapper">
       <div class="floating-nav-panel " id="floatingNavBar">
         <div class="opener py-6 pb-16 px-11 bg-acidgreen text-white font-alt">
           RYCHLÁ NAVIGACE
@@ -305,6 +305,20 @@
       }; /*plus padding*/
     }
   }
+
+  document.addEventListener("DOMContentLoaded", setMaxHeights);
+  window.addEventListener('resize', setMaxHeights);
+
+  function setMaxHeights() {
+    // set height for css transition
+    var accordeonRowBodies = document.getElementsByClassName('accordeon-row-body--classic');
+
+    if (accordeonRowBodies !== null) {
+      for (var i = 0; i < accordeonRowBodies.length; i++) {
+        accordeonRowBodies[i].style.maxHeight = accordeonRowBodies[i].scrollHeight + "px";
+      };
+    }
+  }
 </script>
 
 {% endblock %}
-- 
GitLab