HTMLify

new.js
Views: 51 | Author: itintern
sidenav = document.querySelector(".sidenav");
    menuIcon = document.querySelector(".ri-menu-line");
    navCloseBtn = document.querySelector(".ri-close-large-line");
    menuIcon.addEventListener("click",()=>{
    sidenav.style.display = "flex";

});
navCloseBtn.addEventListener("click",()=>{
    sidenav.style.display = "none";
});

function showModalAdmin(){
    document.querySelector('modal').classList.add('modal-content');
}

document.getElementById("myBtn").onclick = function() {
    document.getElementById("myModalAdmin").style.display = "block";
  };

document.getElementById("myBtn1").onclick = function() {
    document.getElementById("myModalLogin").style.display = "block";
  };

document.getElementById("myBtn2").onclick = function() {
    document.getElementById("myModalLogin").style.display = "block";
  };

document.getElementById("myBtn3").onclick = function() {
    document.getElementById("myModalLogin").style.display = "block";
  };

document.getElementById("myBtn4").onclick = function() {
    document.getElementById("myModal").style.display = "block";
  };
  
document.getElementById("myBtn2").onclick = function() {
  document.getElementById("myModalLogin").style.display = "block";
};

document.getElementById("close").onclick = function() {
    document.getElementById("myModal").style.display = "none";
  };

document.getElementById("closeLogin").onclick = function() {
    document.getElementById("myModalLogin").style.display = "none";
  };

document.querySelector(".closeAdmin").onclick = function() {
    document.getElementById("myModalAdmin").style.display = "none";
  };

document.getElementById("btn").onclick = function() {
    document.getElementById("myModal").style.display = "none";
  };

document.querySelector(".btnLogin").onclick = function() {
    document.getElementById("myModalLogin").style.display = "none";
  };

document.querySelector(".btnAdmin").onclick = function() {
    document.getElementById("myModalAdmin").style.display = "none";
  };
  
  // Optional: To close the modal if the user clicks outside of it
  window.onclick = function(event) {
    if (event.target == document.getElementById("myModal")) {
      document.getElementById("myModal").style.display = "none";
    }
  };

  window.onclick = function(event) {
    if (event.target == document.getElementById("myModalLogin")) {
      document.getElementById("myModalLogin").style.display = "none";
    }
  };

  window.onclick = function(event) {
    if (event.target == document.getElementById("myModalAdmin")) {
      document.getElementById("myModalAdmin").style.display = "none";
    }
  };

Comments