From 05b4f8bc8b384709247bac5f7656eb1bcc50c121 Mon Sep 17 00:00:00 2001 From: chiu Date: Thu, 2 Sep 2021 13:42:28 +0800 Subject: [PATCH] fix error --- assets/javascripts/app.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 9b7997d..0d4c815 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -802,7 +802,12 @@ function transdate(){ $(".kenjohn").addClass('navFixed'); $('.layout-content').css('margin-top',$('.kenjohn').height()); window.setTimeout(function(){ - var theTop = $('.layout-content-inner.container').offset().top-$(".kenjohn").position().top-$(".kenjohn").height()+10; + var theTop; + 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; + } $("html, body").animate({ scrollTop: theTop }, {duration: 500,easing: "swing"}); },100);