This commit is contained in:
rulingcom 2022-12-09 16:46:40 +08:00
parent e38925f397
commit 51ba300b4d
1 changed files with 11 additions and 8 deletions

View File

@ -11,7 +11,7 @@
this.replaceWith(new_html); this.replaceWith(new_html);
} }
}); });
function fix_first_element() { function fix_first_element(reset_only) {
if (!window.has_topest_banner) { if (!window.has_topest_banner) {
$('.downIcon').css('display','none'); $('.downIcon').css('display','none');
var first_element = $('.header-banner'); var first_element = $('.header-banner');
@ -24,13 +24,15 @@
} }
if(first_element.length != 0){ if(first_element.length != 0){
first_element.css("margin-top", ""); first_element.css("margin-top", "");
var ele_offset = first_element[0].getBoundingClientRect().top; if(!reset_only){
if(first_element.parents('.kenjohn.navFixed').length == 0) var ele_offset = first_element[0].getBoundingClientRect().top;
ele_offset -= window.top_barrier_height; if(first_element.parents('.kenjohn.navFixed').length == 0)
if(ele_offset < 0){ ele_offset -= window.top_barrier_height;
first_element.css("margin-top", -ele_offset + "px"); if(ele_offset < 0){
}else{ first_element.css("margin-top", -ele_offset + "px");
first_element.css("margin-top", ""); }else{
first_element.css("margin-top", "");
}
} }
} }
}else{ }else{
@ -490,6 +492,7 @@
var navFixed = $('.kenjohn.navFixed'); var navFixed = $('.kenjohn.navFixed');
window.top_barrier_height = (navFixed.length ? navFixed.height() : 0) + $('#orbit-bar').height(); window.top_barrier_height = (navFixed.length ? navFixed.height() : 0) + $('#orbit-bar').height();
if ($(window).outerWidth() < 769) { if ($(window).outerWidth() < 769) {
fix_first_element(true);
if (resizeTimer) clearTimeout(resizeTimer); if (resizeTimer) clearTimeout(resizeTimer);
$('.outdropdowns').before($('.header-nav')); $('.outdropdowns').before($('.header-nav'));
resizeTimer = setTimeout(function() { resizeTimer = setTimeout(function() {