Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- configure() {
- window.addEventListener('resize', debounce(this.resize.bind(this), 300));
- window.addEventListener('blur', () => once(window, 'focus', this.resize.bind(this)));
- window.addEventListener('click', function(event) {
- if (event.target != box && event.target.parentNode != box) {
- // YOUR CODE TO CLOSE THE MENU
- // IF YOU CLICK OUTSIDE THE MENU
- setTimeout(() => {
- once(window, 'click', () => {
- this.container.classList.remove('opened');
- this.more_list.classList.add('hidden');
- toggleAria(this.more_list, 'aria-expanded');
- });
- }, 100);
- // END
- } else {
- // YOUR CODE TO OPEN/CLOSE THE MENU
- // IF YOU CLICK INSIDE THE MENU
- this.toggle();
- // END
- }
- });
- this.more_btn.addEventListener('click', () => {
- if (this.more_list.classList.contains('hidden')) {
- setTimeout(() => {
- once(window, 'click', () => {
- this.container.classList.remove('opened');
- this.more_list.classList.add('hidden');
- toggleAria(this.more_list, 'aria-expanded');
- });
- }, 100);
- }
- this.container.classList.toggle('opened');
- this.more_list.classList.toggle('hidden');
- toggleAria(this.more_list, 'aria-expanded');
- });
- this.dropdown.addEventListener('click', () => {
- this.toggle();
- });
- this.resize();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement