From 4f5e240e1b1ba2e75ff64903a56501562f04717f Mon Sep 17 00:00:00 2001 From: chiu Date: Thu, 2 Sep 2021 15:12:09 +0800 Subject: [PATCH] fix error --- assets/javascripts/app.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 8fdd4d3..042e94c 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -799,8 +799,9 @@ function transdate(){ }); $('.modules-menu-level-1').css('left','-'+$('.outdropdowns .dropdowns').offset().left+'px'); $(".downIcon").click(function() { - $(".kenjohn").addClass('navFixed'); - window.setTimeout(function(){ + var move_to_target=function (m) { + $(".kenjohn").addClass('navFixed'); + $('.layout-content').css('margin-top',$('.kenjohn').height()); var theTop; if (parseInt($('.layout-content').css('margin-top')==0)){ theTop = $('.layout-content-inner.container').offset().top-$(".kenjohn").position().top+10; @@ -808,8 +809,11 @@ function transdate(){ theTop = $('.layout-content-inner.container').offset().top-$(".kenjohn").position().top-$(".kenjohn").height()+10; } $("html, body").animate({ - scrollTop: theTop }, {duration: 500,easing: "swing"}); - },100); + scrollTop: theTop - m }, {duration: 500,easing: "swing"},function(){ + move_to_target(0); + }); + } + move_to_target(50); return false; });