Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. configure() {
  2.     window.addEventListener('resize', debounce(this.resize.bind(this), 300));
  3.     window.addEventListener('blur', () => once(window, 'focus', this.resize.bind(this)));
  4.     window.addEventListener('click', function(event) {
  5.         if (event.target != box && event.target.parentNode != box) {
  6.             // YOUR CODE TO CLOSE THE MENU
  7.             // IF YOU CLICK OUTSIDE THE MENU
  8.             setTimeout(() => {
  9.                 once(window, 'click', () => {
  10.                     this.container.classList.remove('opened');
  11.                     this.more_list.classList.add('hidden');
  12.                     toggleAria(this.more_list, 'aria-expanded');
  13.                 });
  14.             }, 100);
  15.             // END
  16.  
  17.         } else {
  18.             // YOUR CODE TO OPEN/CLOSE THE MENU
  19.             // IF YOU CLICK INSIDE THE MENU
  20.             this.toggle();
  21.             // END
  22.         }
  23.     });
  24.  
  25.  
  26.  
  27.     this.more_btn.addEventListener('click', () => {
  28.         if (this.more_list.classList.contains('hidden')) {
  29.             setTimeout(() => {
  30.                 once(window, 'click', () => {
  31.                     this.container.classList.remove('opened');
  32.                     this.more_list.classList.add('hidden');
  33.                     toggleAria(this.more_list, 'aria-expanded');
  34.                 });
  35.             }, 100);
  36.         }
  37.  
  38.         this.container.classList.toggle('opened');
  39.         this.more_list.classList.toggle('hidden');
  40.         toggleAria(this.more_list, 'aria-expanded');
  41.     });
  42.  
  43.  
  44.     this.dropdown.addEventListener('click', () => {
  45.         this.toggle();
  46.     });
  47.  
  48.     this.resize();
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement