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)){