Difference between revisions of "Template:BIMATOX Project"

Line 5: Line 5:
 
/* When the user clicks on the button,  
 
/* When the user clicks on the button,  
 
toggle between hiding and showing the dropdown content */
 
toggle between hiding and showing the dropdown content */
function myFunction() {
+
function myFunction(id) {
 
     document.getElementById("myDropdown").classList.toggle("show");
 
     document.getElementById("myDropdown").classList.toggle("show");
 
}
 
}
  
 
// Close the dropdown if the user clicks outside of it
 
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
+
window.onclick = function(e) {
        if (!event.target.matches('.dropbtn')) {
+
  if (!e.target.matches('.dropbtn')) {
                var dropdowns = document.getElementsByClassName("dropdown-content");
+
    var myDropdown = document.getElementById("myDropdown");
                var i;
+
      if (myDropdown.classList.contains('show')) {
                for (i = 0; i < dropdowns.length; i++) {
+
        myDropdown.classList.remove('show');
                        var openDropdown = dropdowns[i];
+
      }
                        if (openDropdown.classList.contains('show')) {
+
  }
                                openDropdown.classList.remove('show');
+
}
  
 
</script>
 
</script>
Line 380: Line 380:
 
   <div class="dropdown">
 
   <div class="dropdown">
 
     <button class="dropbtn" onclick="myFunction('5')">Awards
 
     <button class="dropbtn" onclick="myFunction('5')">Awards
       <i class="awards"></i>
+
       <i class="fa fa-caret-down"></i>
 
     </button>
 
     </button>
 
     <div class="dropdown-content" id="myDropdown">
 
     <div class="dropdown-content" id="myDropdown">

Revision as of 06:10, 27 October 2017