Fix bug.
This commit is contained in:
parent
f5fc124a20
commit
2263dce634
|
@ -11,10 +11,30 @@
|
||||||
this.replaceWith(new_html);
|
this.replaceWith(new_html);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
function fix_layout(){
|
function fix_first_element(reset_only) {
|
||||||
window.has_topest_banner = ($('[data-pp="300"] .w-ad-banner').length != 0);
|
|
||||||
if (!window.has_topest_banner) {
|
if (!window.has_topest_banner) {
|
||||||
$('.downIcon').css('display','none')
|
$('.downIcon').css('display','none');
|
||||||
|
var first_element = $('.header-banner');
|
||||||
|
if(first_element.length == 0){
|
||||||
|
first_element = $('.layout-content .layout-content-inner').eq(0);
|
||||||
|
}else{
|
||||||
|
if(first_element.html() == ''){
|
||||||
|
first_element = $('.layout-content .layout-content-inner').eq(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(first_element.length != 0){
|
||||||
|
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{
|
}else{
|
||||||
$("#onesection").css("margin", "0");
|
$("#onesection").css("margin", "0");
|
||||||
$('.layout-content-inner .row, .layout-content-inner .row > [class*="col-"]').css("padding", "0");
|
$('.layout-content-inner .row, .layout-content-inner .row > [class*="col-"]').css("padding", "0");
|
||||||
|
@ -456,8 +476,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// 在所有的頁面(包含首頁)執行下面這幾個函數
|
// 在所有的頁面(包含首頁)執行下面這幾個函數
|
||||||
fix_layout();
|
window.has_topest_banner = ($('[data-pp="300"] .w-ad-banner').length != 0);
|
||||||
initdata1();
|
initdata1();
|
||||||
|
fix_first_element();
|
||||||
|
window.setTimeout(fix_first_element, 3000);
|
||||||
orbit.sitemenuDropdown();
|
orbit.sitemenuDropdown();
|
||||||
orbit.goBackTop('top', 800);
|
orbit.goBackTop('top', 800);
|
||||||
orbit.plugins.bullEye();
|
orbit.plugins.bullEye();
|
||||||
|
@ -482,6 +504,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() >200) {
|
if ($(window).outerWidth() >200) {
|
||||||
|
fix_first_element();
|
||||||
if (resizeTimer) clearTimeout(resizeTimer);
|
if (resizeTimer) clearTimeout(resizeTimer);
|
||||||
$('.outdropdowns').before($('.header-nav'));
|
$('.outdropdowns').before($('.header-nav'));
|
||||||
resizeTimer = setTimeout(function() {
|
resizeTimer = setTimeout(function() {
|
||||||
|
@ -493,6 +516,7 @@
|
||||||
$('.navbar-toggle').bind(orbit.ClickMenuHandler());
|
$('.navbar-toggle').bind(orbit.ClickMenuHandler());
|
||||||
}
|
}
|
||||||
},500 )} else {
|
},500 )} else {
|
||||||
|
fix_first_element(true);
|
||||||
resizeTimer = setTimeout(function(){
|
resizeTimer = setTimeout(function(){
|
||||||
if( $('.mobile-menu .modules-menus').length > 0 ) {
|
if( $('.mobile-menu .modules-menus').length > 0 ) {
|
||||||
$('.navbar-header').after($('.modules-menus'));
|
$('.navbar-header').after($('.modules-menus'));
|
||||||
|
|
Loading…
Reference in New Issue