'headerfixed'

This commit is contained in:
ken 2023-05-15 21:06:30 +08:00
parent 0e8c2b24bb
commit 86f7d3f838
2 changed files with 21 additions and 13 deletions

View File

@ -56,25 +56,30 @@
window.temp_scrollY = document.documentElement.scrollTop;
window.temp_scrollX = document.documentElement.scrollLeft;
}
if ($('.header-banner').html().trim() == "") {
$('.downIcon').css('display','none')
}
// if (location.href.search('editmode') == -1 && document.getElementsByClassName('asideright').length != 0) {
if ( $('.header-banner').length != 0 ) {
if ( $('.header-banner').length != 0) {
$('.layout-header').css('height', '');
var scrollTop = $(window).scrollTop();
if (!window.has_topest_banner){
$('.kenjohn').removeClass('navRel').addClass('navFixed'); /* 正常選單固定效果 */
}else if (scrollTop>5) { /* 要滑動到選單的距離 */
var scrollBottom = $('html').height() - $(window).height() - $('.kenjohn').height();
if (scrollTop>5 && scrollBottom>0) { /* 要滑動到選單的距離 */
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'); /* 幫選單加上固定效果 */
} else {
$('.kenjohn').removeClass('navRel').removeClass('navFixed'); /* 移除選單固定效果 */
if ($('.header-banner').html().trim() == "") {
$('.kenjohn').removeClass('navFixed').addClass('navRel');
}else{
$('.kenjohn').removeClass('navRel').removeClass('navFixed'); /* 移除選單固定效果 */
}
$('.layout-content').css('margin-top','');
}
}
var navFixed = $('.kenjohn.navFixed');
window.top_barrier_height = (navFixed.length ? navFixed.height() : 0) + $('#orbit-bar').height();
fix_first_element();
}
// 初始函數: 把所有的程式碼都包在init裡面方便在之後的jQuery ready 函數裡一次呼叫
function init() {

View File

@ -510,21 +510,24 @@ ul.button-mid{
height: 1290px;
}
@media(min-width:1601px)and (max-width:1920px){
height: 895px;
height: 1040px;
}
@media screen and (min-width:1441px) and (max-width:1600px){
height: 725px;
@media screen and (min-width:1540px) and (max-width:1600px){
height: 860px;
}
@media screen and (min-width:1440px) and (max-width:1540px){
height: 700px;
}
@media screen and (min-width:1440px) and (max-width:1441px){
height: 764px;
height: 860px;
}
@media screen and (min-width:1281px) and (max-width:1439px){
height: 595px;
height: 730px;
}
@media screen and (min-width:1025px) and (max-width:1280px){
height: 545px;
height: 680px;
}
@media (max-width:1280px){
@media (max-width:1279px){
width:100%;
height: auto;
max-width: fit-content;