Adjusted the js so that it can be used in a partial at two locations

This commit is contained in:
tsmitty11 2023-05-15 21:59:58 +02:00
parent 89e5e8af1f
commit 0920ce5bc6

View file

@ -30,16 +30,17 @@
</div> </div>
<div class="dropdown"> <div class="dropdown">
<button onclick="toggleDropdown()" class="dropbtn hbtn-light hb-light-fill-right"> <button onclick="toggleDropdown(this)" class="dropbtn hbtn-light hb-light-fill-right">
additional install options additional install options
<span id="arrow" class="arrow" style="font-size:16px;">&#8250;</span> <span class="arrow" style="font-size:16px;">&#8250;</span>
</button> </button>
<div id="myDropdown" class="dropdown-content"> <div class="dropdown-content">
<a href="https://docs.tea.xyz/getting-started/install-tea/without-installer#a-fancy-one-liner">fancy one-liner</a> <a href="https://docs.tea.xyz/getting-started/install-tea/without-installer#a-fancy-one-liner">fancy one-liner</a>
<a href="https://docs.tea.xyz/getting-started/install-tea/without-installer#via-homebrew">hombrew</a> <a href="https://docs.tea.xyz/getting-started/install-tea/without-installer#via-homebrew">hombrew</a>
<a href="https://docs.tea.xyz/getting-started/install-tea/without-installer#via-docker">via docker</a> <a href="https://docs.tea.xyz/getting-started/install-tea/without-installer#via-docker">via docker</a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@ -147,9 +148,9 @@
<script> <script>
function toggleDropdown() { function toggleDropdown(dropdownButton) {
var dropdown = document.getElementById("myDropdown"); var dropdown = dropdownButton.nextElementSibling;
var arrow = document.getElementById("arrow"); var arrow = dropdownButton.querySelector('.arrow');
dropdown.classList.toggle("show"); dropdown.classList.toggle("show");
arrow.classList.toggle("rotated", dropdown.classList.contains("show")); arrow.classList.toggle("rotated", dropdown.classList.contains("show"));
} }
@ -169,4 +170,5 @@
} }
}; };
</script> </script>