function fixSubmenuRight(){

			var submenus = $('> li .sub-menu, > .megamenu--half-width .megamenu', menu);

			if($('body').innerWidth() > mobileWidthBase){
				var menu_width = $("body").outerWidth(true);

				for(var i = 0; i < submenus.length; i++){
					var submenusPosition = $(submenus[i]).css("display", "block").offset().left;
					$(submenus[i]).css("display", "none");

					if($(submenus[i]).outerWidth() + submenusPosition > menu_width){
						$(submenus[i]).addClass("sub-menu-right");
					}

					else{
						if(menu_width == $(submenus[i]).outerWidth() || (menu_width - $(submenus[i]).outerWidth()) < 20){
							$(submenus[i]).addClass("sub-menu-right");
						}
						if(submenusPosition + $(submenus[i]).outerWidth() < menu_width){
							$(submenus[i]).addClass("sub-menu-left");
						}
					}
				}
			}
		}
// Fix the submenu on the right side
Fix the submenu on the right side
Fix the submenu on the right side
function fixSubmenuRight(){
			var submenus = $('> li .sub-menu, > .megamenu--half-width .megamenu', menu);
			if($('body').innerWidth() > mobileWidthBase){
				var menu_width = $("body").outerWidth(true);
				for(var i = 0; i < submenus.length; i++){
					var submenusPosition = $(submenus[i]).css("display", "block").offset().left;
					$(submenus[i]).css("display", "none");
					if($(submenus[i]).outerWidth() + submenusPosition > menu_width){
						$(submenus[i]).addClass("sub-menu-right");
					}
					else{
						if(menu_width == $(submenus[i]).outerWidth() || (menu_width - $(submenus[i]).outerWidth()) < 20){
							$(submenus[i]).addClass("sub-menu-right");
						}
						if(submenusPosition + $(submenus[i]).outerWidth() < menu_width){
							$(submenus[i]).addClass("sub-menu-left");
						}
					}
				}
			}
		}
function fixSubmenuRight ( ) { var submenus = $ ( '> li .sub-menu, > .megamenu--half-width .megamenu' , menu ) ; if ( $ ( 'body' ) . innerWidth ( ) > mobileWidthBase ) { var menu_width = $ ( "body" ) . outerWidth ( true ) ; for ( var i = 0 ; i < submenus . length ; i ++ ) { var submenusPosition = $ ( submenus [ i ] ) . css ( "display" , "block" ) . offset ( ) . left ; $ ( submenus [ i ] ) . css ( "display" , "none" ) ; if ( $ ( submenus [ i ] ) . outerWidth ( ) + submenusPosition > menu_width ) { $ ( submenus [ i ] ) . addClass ( "sub-menu-right" ) ; } else { if ( menu_width == $ ( submenus [ i ] ) . outerWidth ( ) || ( menu_width - $ ( submenus [ i ] ) . outerWidth ( ) ) < 20 ) { $ ( submenus [ i ] ) . addClass ( "sub-menu-right" ) ; } if ( submenusPosition + $ ( submenus [ i ] ) . outerWidth ( ) < menu_width ) { $ ( submenus [ i ] ) . addClass ( "sub-menu-left" ) ; } } } } }
Fix the submenu on the right side
Fix the submenu on the right side