<div id="main-menu">
  <div id="menu-container-<?= $this -> menu['id'];?>">
   <?= \front\view\Menu::pages( $this -> menu['pages'], 0, $this -> current_page );?>
  </div>
</div>
<button id="main-menu-btn" aria-label="Menu"><span></span><span></span><span></span></button>
<script class="footer" type="text/javascript">
  $(window).resize(function() {
    windowsize = $(window).width();
  });

  $( 'body' ).on( click_event, '#main-menu-btn', function()
  {
    if ( windowsize <= 767 )
    {
      if ( $( this ).hasClass( 'active' ) )
      {
        $( this ).removeClass( 'active' );
        $( '#main-menu' ).removeClass( 'visible' );
      }
      else
      {
        $( this ).addClass( 'active' );
        $( '#main-menu' ).addClass( 'visible' );
      }
    }
  });

  $( 'body' ).on( click_event, '#menu-container-<?= $this -> menu['id'];?> > ul > li > a', function(e)
  {
    if ( windowsize <= 767 )
    {
      if ( $( this ).parent().hasClass( 'parent' ) )
        e.preventDefault();

      if ( !$( this ).parent().hasClass( 'active' ) )
      {
        $( '#menu-container-<?= $this -> menu['id'];?> > ul > li' ).removeClass( 'active' );
        $( this ).parent().addClass( 'active' );
      }
    }
  });
</script>
