lib/composites/menu/events/main.js
function onTriggerClick(e, noFocus) {
    toggleSubmenu(elements.trigger, (_, done) => {
      Classlist(elements.trigger).toggle(ACTIVE_CLASS);
      const wasActive = Classlist(elements.menu).contains(ACTIVE_CLASS);
      const first = wasActive ? ACTIVE_CLASS : 'dqpl-show';
      const second = first === ACTIVE_CLASS ? 'dqpl-show' : ACTIVE_CLASS;

      Classlist(elements.menu).toggle(first);

      if (elements.scrim) {
        Classlist(elements.scrim).toggle('dqpl-scrim-show');
      }

      setTimeout(() => {
        Classlist(elements.menu).toggle(second);
        if (elements.scrim) { Classlist(elements.scrim).toggle('dqpl-scrim-fade-in'); }
        setTimeout(() => done(noFocus));
      }, 100);
    });
  }
function onTriggerClick(e, noFocus) {
    toggleSubmenu(elements.trigger, (_, done) => {
      Classlist(elements.trigger).toggle(ACTIVE_CLASS);
      const wasActive = Classlist(elements.menu).contains(ACTIVE_CLASS);
      const first = wasActive ? ACTIVE_CLASS : 'dqpl-show';
      const second = first === ACTIVE_CLASS ? 'dqpl-show' : ACTIVE_CLASS;

      Classlist(elements.menu).toggle(first);

      if (elements.scrim) {
        Classlist(elements.scrim).toggle('dqpl-scrim-show');
      }

      setTimeout(() => {
        Classlist(elements.menu).toggle(second);
        if (elements.scrim) { Classlist(elements.scrim).toggle('dqpl-scrim-fade-in'); }
        setTimeout(() => done(noFocus));
      }, 100);
    });
  }
function onTriggerClick ( e , noFocus ) { toggleSubmenu ( elements . trigger , ( _ , done ) => { Classlist ( elements . trigger ) . toggle ( ACTIVE_CLASS ) ; const wasActive = Classlist ( elements . menu ) . contains ( ACTIVE_CLASS ) ; const first = wasActive ? ACTIVE_CLASS : 'dqpl-show' ; const second = first === ACTIVE_CLASS ? 'dqpl-show' : ACTIVE_CLASS ; Classlist ( elements . menu ) . toggle ( first ) ; if ( elements . scrim ) { Classlist ( elements . scrim ) . toggle ( 'dqpl-scrim-show' ) ; } setTimeout ( ( ) => { Classlist ( elements . menu ) . toggle ( second ) ; if ( elements . scrim ) { Classlist ( elements . scrim ) . toggle ( 'dqpl-scrim-fade-in' ) ; } setTimeout ( ( ) => done ( noFocus ) ) ; } , 100 ) ; } ) ; }
Handles clicks on trigger
- toggles classes
- handles animation
Handles clicks on trigger - toggles classes - handles animation