From 5811b8f50479ff47e7da084ba9e450ea9ebf5fc2 Mon Sep 17 00:00:00 2001 From: chiu Date: Thu, 2 Sep 2021 15:21:58 +0800 Subject: [PATCH] fix --- assets/javascripts/app.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 042e94c..a437db2 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -799,21 +799,29 @@ function transdate(){ }); $('.modules-menu-level-1').css('left','-'+$('.outdropdowns .dropdowns').offset().left+'px'); $(".downIcon").click(function() { - var move_to_target=function (m) { - $(".kenjohn").addClass('navFixed'); - $('.layout-content').css('margin-top',$('.kenjohn').height()); + var move_to_target=function (stop) { var theTop; - if (parseInt($('.layout-content').css('margin-top')==0)){ - theTop = $('.layout-content-inner.container').offset().top-$(".kenjohn").position().top+10; + if (stop){ + $(".kenjohn").addClass('navFixed'); + $('.layout-content').css('margin-top',$('.kenjohn').height()); + if (parseInt($('.layout-content').css('margin-top')==0)){ + theTop = $('.layout-content-inner.container').offset().top-$(".kenjohn").position().top+10; + }else{ + theTop = $('.layout-content-inner.container').offset().top-$(".kenjohn").position().top-$(".kenjohn").height()+10; + } }else{ - theTop = $('.layout-content-inner.container').offset().top-$(".kenjohn").position().top-$(".kenjohn").height()+10; + theTop = 10; } + console.log(theTop); $("html, body").animate({ - scrollTop: theTop - m }, {duration: 500,easing: "swing"},function(){ - move_to_target(0); - }); + scrollTop: theTop }, {duration: 500,easing: "swing",complete: function(){ + console.log('finish'); + if(!stop){ + move_to_target(true); + } + }}); } - move_to_target(50); + move_to_target(false); return false; });