Difference between revisions of "Template:BIMATOX Project"

Line 6: Line 6:
 
toggle between hiding and showing the dropdown content */
 
toggle between hiding and showing the dropdown content */
 
function myFunction(id) {
 
function myFunction(id) {
    document.getElementById("myDropdown").classList.toggle("show");
+
        var dropdowns = document.getElementsByCLassName("dropdown-content");
 +
                var i;
 +
                for (i = 0; i < dropdowns.length; i++) {
 +
                        var openDropdown = dropdowns[i];
 +
                        if ( dropdowns[i] != document.getElementById(id) ) {
 +
                                openDropdown.classList.remove('show');
 +
                        }
 +
                }
 +
          document.getElementById(id).classList.toggle("show");
 
}
 
}
 
+
// Close the dropdown if the user clicks in window.
// 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');
 +
                        }
 +
                }
 +
        }
 
}
 
}
  
Line 324: Line 335:
  
 
   <div class="dropdown">
 
   <div class="dropdown">
     <button class="dropbtn" onclick="myFunction(1)">Team
+
     <button class="dropbtn" onclick="myFunction('1')">Team
 
       <i class="fa fa-caret-down"></i>
 
       <i class="fa fa-caret-down"></i>
 
     </button>
 
     </button>
     <div class="dropdown-content" id="myDropdown">
+
     <div class="dropdown-content" id="1">
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Team">Team</a>
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Team">Team</a>
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Collaborations">Collaborations</a>
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Collaborations">Collaborations</a>
Line 334: Line 345:
  
 
   <div class="dropdown">
 
   <div class="dropdown">
     <button class="dropbtn" onclick="myFunction(2)">Project
+
     <button class="dropbtn" onclick="myFunction('2')">Project
 
       <i class="fa fa-caret-down"></i>
 
       <i class="fa fa-caret-down"></i>
 
     </button>
 
     </button>
     <div class="dropdown-content" id="myDropdown">
+
     <div class="dropdown-content" id="2">
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Proyect">Description</a>
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Proyect">Description</a>
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Proyect">Design</a>
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Proyect">Design</a>
Line 356: Line 367:
 
       <i class="fa fa-caret-down"></i>
 
       <i class="fa fa-caret-down"></i>
 
     </button>
 
     </button>
     <div class="dropdown-content" id="myDropdown">
+
     <div class="dropdown-content" id="3">
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Parts">Parts</a>
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Parts">Parts</a>
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Parts">Basic Parts</a>
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Parts">Basic Parts</a>
Line 370: Line 381:
 
       <i class="fa fa-caret-down"></i>
 
       <i class="fa fa-caret-down"></i>
 
     </button>
 
     </button>
     <div class="dropdown-content" id="myDropdown">
+
     <div class="dropdown-content" id="4">
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Human_Practices">Human Practices</a>
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Human_Practices">Human Practices</a>
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Human_Practices">Silver HP</a>
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Human_Practices">Silver HP</a>
Line 382: Line 393:
 
       <i class="fa fa-caret-down"></i>
 
       <i class="fa fa-caret-down"></i>
 
     </button>
 
     </button>
     <div class="dropdown-content" id="myDropdown">
+
     <div class="dropdown-content" id="5">
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Awards">Applied Design</a>
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Awards">Applied Design</a>
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Awards">Entrepreneurship</a>
 
       <a href="https://2017.igem.org/Team:UChile_Biotec/Awards">Entrepreneurship</a>

Revision as of 06:19, 27 October 2017