Created
April 2, 2019 22:52
-
-
Save wendelnascimento/e3cefe62f8ede6f4cf6e49c83889c725 to your computer and use it in GitHub Desktop.
Modal js script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var modal = document.querySelector('.modal-container'); | |
var btnOpen = document.querySelectorAll('.btn-open'); | |
var btnClose = document.querySelector('.btn-close'); | |
var modalSkin = document.querySelector('.modal-skin'); | |
for (var i = 0; i < btnOpen.length; i++) { | |
btnOpen[i].addEventListener('click', function() { | |
modalToggle(); | |
}); | |
} | |
btnClose.addEventListener('click', function() { | |
modalToggle(); | |
}); | |
modalSkin.addEventListener('click', function() { | |
modalToggle(); | |
}); | |
function modalToggle() { | |
modal.classList.toggle('opened'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment