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