From f192a42a7bd924e890100b8e1f8d229996c53cc5 Mon Sep 17 00:00:00 2001 From: rulingcom Date: Mon, 3 Jan 2022 15:09:02 +0000 Subject: [PATCH] Fix js bug. --- assets/javascripts/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 4a52dd9..f6cddf9 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -11,7 +11,7 @@ var scrollTop = $(window).scrollTop(); var scrollBottom = $('html').height() - $(window).height() - $('.kenjohn').height(); if (scrollTop>5 && scrollBottom>0) { /* 要滑動到選單的距離 */ - if (parseInt($('.layout-content').css('margin-top'))==0 && $('.layout-content.topcontent').offset().top<400){ + if (parseInt($('.layout-content').css('margin-top'))==0 && $('.layout-content.topcontent').length != 0 && $('.layout-content.topcontent').offset().top<400){ $('.layout-content').css('margin-top',$('.kenjohn').height()-$('#orbit-bar').height()); } $('.kenjohn').addClass('navFixed').removeClass('navRel'); /* 幫選單加上固定效果 */ @@ -832,7 +832,7 @@ function transdate(){ var theTop; if (stop){ $(".kenjohn").addClass('navFixed'); - if ($('.layout-content.topcontent').offset().top<400){ + if ($('.layout-content.topcontent').length != 0 && $('.layout-content.topcontent').offset().top<400){ $('.layout-content').css('margin-top',$('.kenjohn').height()-$('#orbit-bar').height()); } if (parseInt($('.layout-content').css('margin-top')==0)){