jQuery(document).ready(function ($) {

    $('.main-navigation').meanmenu({
		meanMenuContainer: '.menu-navigation',
         meanScreenWidth: "767",
         meanRevealPosition: "right",
	});   
	
	// 	mean menu focus

	    
  $('.mean-bar').on('keydown', function (e) {

      $(".sub-menu").attr("aria-expanded", "true");
      var focusableEls = $(' .mean-bar .meanmenu-reveal, .mean-bar a[href]:not([disabled]), .mean-bar li');
      var firstFocusableEl = focusableEls[0];
      var lastFocusableEl = focusableEls[focusableEls.length - 1];


      var KEYCODE_TAB = 9;
      if (e.key === 'Tab' || e.keyCode === KEYCODE_TAB) {

          if (e.shiftKey) /* shift + tab */ {
              if (document.activeElement === firstFocusableEl) {

              }
          } else /* tab */ {
              if (document.activeElement === lastFocusableEl) {
                  firstFocusableEl.focus();
                  e.preventDefault();
              }
          }
      }

  });

});

