animation.js 663 B

12345678910111213141516171819
  1. /* When the user clicks on the button,
  2. toggle between hiding and showing the dropdown content */
  3. function dropDownFunc() {
  4. document.getElementById("dropdown").classList.toggle("show");
  5. }
  6. // Close the dropdown if the user clicks outside of it
  7. window.onclick = function (event) {
  8. if (!event.target.matches('.dropbtn')) {
  9. var dropdowns = document.getElementsByClassName("dropdown-content");
  10. var i;
  11. for (i = 0; i < dropdowns.length; i++) {
  12. var openDropdown = dropdowns[i];
  13. if (openDropdown.classList.contains('show')) {
  14. openDropdown.classList.remove('show');
  15. }
  16. }
  17. }
  18. }