This commit is contained in:
chiu 2021-08-31 18:01:12 +08:00
parent 8aa583cc2f
commit c2a62aad17
1 changed files with 6 additions and 2 deletions

View File

@ -9,8 +9,11 @@
if ( $('.header-banner').length != 0) {
$('.layout-header').css('height', '');
var scrollTop = $(window).scrollTop();
var scrollBottom = $('html').height() - $(window).height() - $('.kenjohn').height()*2;
if (scrollTop>50 && scrollBottom>0) { /* 要滑動到選單的距離 */
var scrollBottom = $('html').height() - $(window).height() - $('.kenjohn').height();
if (scrollTop>5 && scrollBottom>0) { /* 要滑動到選單的距離 */
if (parseInt($('.layout-content').css('margin-top'))==0){
$('.layout-content').css('margin-top',$('.kenjohn').height());
}
$('.kenjohn').addClass('navFixed').removeClass('navRel'); /* 幫選單加上固定效果 */
} else {
if ($('.header-banner').html().trim() == "") {
@ -18,6 +21,7 @@
}else{
$('.kenjohn').removeClass('navRel').removeClass('navFixed'); /* 移除選單固定效果 */
}
$('.layout-content').css('margin-top','');
}
}
}