From d9e49d83fe1df7b11ee97930ad9e719fd3eeca94 Mon Sep 17 00:00:00 2001 From: rulingcom Date: Wed, 8 Dec 2021 02:26:00 +0000 Subject: [PATCH] fix menu error --- assets/javascripts/app.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 618bdf4..606ee87 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -857,11 +857,14 @@ function transdate(){ }); }); + var calc_menu_flag = false; function calc_menu_pos(){ if ($(window).outerWidth() < 769){ + calc_menu_flag = false; $('.modules-menu-level-1').css('right','') $('.modules-menu-level-1').css('width','') }else{ + calc_menu_flag = true; var width = $('#main-nav').outerWidth(); var right = $(window).width() - $('#main-nav').offset().left - width; $('.modules-menu-level-1').css('right',right) @@ -870,17 +873,24 @@ function transdate(){ } $(window).resize(function() { - //$('.modules-menu-level-1').css('left','-'+$('.outdropdowns .dropdowns').offset().left+'px'); + //$('.modules-menu-level-1').css('calc_menu_flagleft','-'+$('.outdropdowns .dropdowns').offset().left+'px'); calc_menu_pos(); - window.has_hover = false; + window.has_hover = fcalc_menu_flagalse; if($(window).outerWidth(true) >= 768){ window.has_hover = true; } }); - + + $('#main-nav>li').mouseover(function(){ + if (!calc_menu_flag){ + calc_menu_pos(); + } + }); $(window).load(function(){ - calc_menu_pos(); + if($('#main-nav').outerWidth()>50){ + calc_menu_pos(); + } $("iframe[src*='google']").attr('title','googleOauth'); });