From a505955cfd4a0169e4e0c28a3b2d6b495e33be0a Mon Sep 17 00:00:00 2001 From: rulingcom Date: Tue, 7 Dec 2021 06:21:20 +0000 Subject: [PATCH] fix menu position --- assets/javascripts/app.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index be8f95d..9de4732 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -857,12 +857,22 @@ function transdate(){ }); }); + function calc_menu_pos(){ + if ($(window).outerWidth() < 769){ + $('.modules-menu-level-1').css('right','') + $('.modules-menu-level-1').css('width','') + }else{ + var width = $('#main-nav').outerWidth(); + var right = $(window).width() - $('#main-nav').offset().left - width; + $('.modules-menu-level-1').css('right',right) + $('.modules-menu-level-1').css('width',width) + } + } $(document).resize(function() { - $('.modules-menu-level-1').css('left','-'+$('.outdropdowns .dropdowns').offset().left+'px'); - if ($(window).outerWidth() < 769){ - $('.modules-menu-level-1').css('left','') - } + //$('.modules-menu-level-1').css('left','-'+$('.outdropdowns .dropdowns').offset().left+'px'); + calc_menu_pos(); + window.has_hover = false; if($(window).outerWidth(true) >= 768){ window.has_hover = true; @@ -870,6 +880,7 @@ function transdate(){ }); $(window).load(function(){ + calc_menu_pos(); $("iframe[src*='google']").attr('title','googleOauth'); });