(function () { function shouldRun() { var b = document.body; return b && (b.classList.contains('home') || b.classList.contains('page-id-839')); } function initNavFix() { if (!shouldRun()) return; var navWrap = document.querySelector('.medu-header'); if (!navWrap) return; if (navWrap.dataset.zrNavFixedInit === '1') return; navWrap.dataset.zrNavFixedInit = '1'; if (!document.getElementById('zr-nav-fix-style')) { var style = document.createElement('style'); style.id = 'zr-nav-fix-style'; style.textContent = '.zr-nav-fixed{position:fixed !important;left:0 !important;right:0 !important;top:0 !important;z-index:10020 !important;width:100% !important;}' + 'body.admin-bar .zr-nav-fixed{top:32px !important;}'; document.head.appendChild(style); } var triggerTop = Math.round(navWrap.getBoundingClientRect().top + window.scrollY); function onScroll() { var fixed = navWrap.classList.contains('zr-nav-fixed'); if (window.scrollY >= triggerTop) { if (!fixed) { navWrap.classList.add('zr-nav-fixed'); document.body.style.paddingTop = navWrap.offsetHeight + 'px'; } } else { if (fixed) { navWrap.classList.remove('zr-nav-fixed'); document.body.style.paddingTop = ''; } } } function onResize() { var wasFixed = navWrap.classList.contains('zr-nav-fixed'); if (wasFixed) { navWrap.classList.remove('zr-nav-fixed'); document.body.style.paddingTop = ''; } triggerTop = Math.round(navWrap.getBoundingClientRect().top + window.scrollY); onScroll(); } window.addEventListener('scroll', onScroll, { passive: true }); window.addEventListener('resize', onResize); onScroll(); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function () { setTimeout(initNavFix, 300); }); } else { setTimeout(initNavFix, 300); } })();

加载中…

正在加载文章详情…