Advertisement
loloof64

Exercise - Modal - Css3

Mar 15th, 2021
970
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var backdrop = document.querySelector('.backdrop');
  2. var modal = document.querySelector('.modal');
  3.  
  4. var noButton = document.querySelector('.modal__action--negative');
  5.  
  6. var planButtons = document.querySelectorAll('.plan button');
  7. planButtons.forEach(function(item) {
  8.     item.addEventListener('click', function() {
  9.         backdrop.style.display = 'block';
  10.         modal.style.display = 'block';
  11.     });
  12. })
  13.  
  14. noButton.addEventListener('click', function() {
  15.     backdrop.style.display = 'none';
  16.     modal.style.display = 'none';
  17. });
  18.  
  19. backdrop.addEventListener('click', function() {
  20.     backdrop.style.display = 'none';
  21.     modal.style.display = 'none';
  22. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement