Difference between revisions of "Template:BIMATOX Project"

Line 19: Line 19:
 
// Close the dropdown if the user clicks outside of it
 
// Close the dropdown if the user clicks outside of it
  
window.onclick = function(e) {
+
window.onclick = function(event) {
   if (!e.target.matches('.dropbtn')) {
+
   if (!event.target.matches('.dropbtn')) {
     var myDropdown = document.getElementById(id);
+
 
       if (myDropdown.classList.contains('show')) {
+
     var dropdowns = document.getElementsByClassName("dropdown-content");
         myDropdown.classList.remove('show');
+
    var i;
 +
    for (i = 0; i < dropdowns.length; i++) {
 +
      var openDropdown = dropdowns[i];
 +
       if (openDropdown.classList.contains('show')) {
 +
         openDropdown.classList.remove('show');
 
       }
 
       }
 +
    }
 
   }
 
   }
 
}
 
}

Revision as of 06:49, 29 October 2017