Файловый менеджер - Редактировать - /home/kunzqhe/photostocker/wp-content/themes/themify-ultra/themify/js/modules/fixedheader.min.js
Назад
let ThemifyFixedHeader;((o,d,n)=>{"use strict";let l=!1,t=!1;ThemifyFixedHeader={active:!1,isTransparent:!1,headerWrap:null,type:"sticky",normalHeight:0,fixedHeight:0,transitionDuration:0,init(e){if(this.headerWrap=(e="object"!=typeof e?{}:e).headerWrap||d.tfId("headerwrap"),null!==this.headerWrap&&0!==this.headerWrap.length){if((e.hasHeaderRevealing||d.body.classList.contains("revealing-header"))&&this.headerRevealing(e.revealingInvert),!e.disableWatch){const t=this.headerWrap.querySelector("#header"),i=d.createElement("div");this.type=getComputedStyle(this.headerWrap).getPropertyValue("position"),this.type||(this.type="static"),i.className="tf_hidden tf_w",i.style.height="0",i.style.contain="strict",this.isTransparent=!!e.isTransparent||"fixed"===this.type||d.body.classList.contains("transparent-header"),this.isTransparent&&(i.className+=" tf_rel",this.calculateTop(i)),this.headerWrap.after(i),null!==t&&(this.transitionDuration=parseFloat(getComputedStyle(t).getPropertyValue("transition-duration")),this.transitionDuration<10)&&(this.transitionDuration*=1e3),new IntersectionObserver((e,t)=>{const i=e[0].boundingClientRect,a=e[0].rootBounds;a?!1===this.active&&i.bottom<a.top?this.enable():!0===this.active&&i.bottom<a.bottom&&this.disable():t.disconnect()},{threshold:[0,1]}).observe(i),"sticky"!==this.type&&"-webkit-sticky"!==this.type&&(new MutationObserver((e,t)=>{o.is_builder_active?t.disconnect():setTimeout(()=>{this.calculateTop(i)},300)}).observe(this.headerWrap,{subtree:!0,childList:!0,characterData:!0}),o.on("tfsmartresize",()=>{setTimeout(()=>{this.calculateTop(i)},400)}),n.tfOn("scroll",()=>{this.calculateTop(i)},{passive:!0,once:!0}))}o.trigger("tf_fixed_header_ready",this.headerWrap)}},setPadding(){this.active&&0<this.normalHeight&&("relative"===this.type||"static"===this.type)&&(this.headerWrap.parentNode.style.paddingTop=this.normalHeight+"px")},calculateTop(h,e){return new Promise(async s=>{const r=!0===e||!0===this.active&&("relative"===this.type||"static"===this.type),n=[this.headerWrap,this.normalHeight,this.fixedHeight];if(!0===l&&r)return n;r&&(l=!0),requestAnimationFrame(async()=>{let e=this.headerWrap;if(r){const t=(e=e.cloneNode(!0)).querySelector("#header");if(null===d.tfId("tf_fixed_header_st")){const a=d.createElement("style");a.id="tf_fixed_header_st",a.textContent=".tf_disabled_transition,.tf_disabled_transition *{transition:none!important;animation:none!important}",d.head.appendChild(a)}e.classList.remove("fixed-header"),e.classList.add("tf_hidden","tf_opacity","tf_disabled_transition"),e.style.position="fixed",e.style.top="-1000%",e.style.contain="style paint layout",t.previousElementSibling||(t.style.marginTop=0),t.nextElementSibling||(t.style.marginBottom=0),this.headerWrap.before(e)}await o.imagesLoad(e);const i=e.getBoundingClientRect();if(this.normalHeight=i.height,this.isTransparent&&h){let e=i.bottom,t=d.tfId("wpadminbar");t&&(e-=t.offsetHeight),h.style.top=e+"px"}e.classList.contains("tf_disabled_transition")&&(e.classList.add("fixed-header"),this.fixedHeight=e.getBoundingClientRect().height,o.trigger("tf_fixed_header_calculate",[this.headerWrap,this.normalHeight,this.fixedHeight])),r&&(e.remove(),this.setPadding()),l=!1,e=null,s(n)})})},headerRevealing(t){let i=0;const a=this,e=["scroll"],s=d.body.classList,r=function(){if(!1!==a.active&&i!==this.scrollY){const e=t?i<this.scrollY:i>=this.scrollY;i=this.scrollY,e||0===i||s.contains("mobile-menu-visible")||s.contains("slide-cart-visible")?a.headerWrap.classList.remove("header_hidden"):0<i&&!a.headerWrap.classList.contains("header_hidden")&&a.headerWrap.classList.add("header_hidden")}};o.isTouch&&(e.push("touchstart"),e.push("touchmove")),n.tfOn(e,r,{passive:!0}),r.call(n)},enable(){!1===this.active&&!1===t&&(t=!0,(()=>new Promise(i=>{if("undefined"!=typeof themifyScript&&themifyScript.sticky_header&&themifyScript.sticky_header.src){let t=d.tfId("site-logo");if(t){t=t.tfTag("a")[0]||t;const a=new Image,s=t.tfClass("site-logo-image")[0];let e;e=s?s.alt:(e=t.tfTag("span")[0])?e.textContent:"",a.src=themifyScript.sticky_header.src,a.alt=e,a.className="tf_sticky_logo",themifyScript.sticky_header.imgwidth?a.width=themifyScript.sticky_header.imgwidth:s&&(a.width=s.width),themifyScript.sticky_header.imgheight?a.height=themifyScript.sticky_header.imgheight:s&&(a.height=s.height),themifyScript.sticky_header=null,a.decode().finally(()=>{t.prepend(a),i()})}else i()}else i()}))().finally(()=>{if(t=!1,this.active=!0,d.body.classList.add("fixed-header-on"),this.headerWrap.classList.add("fixed-header"),this.setPadding(),0===this.transitionDuration){const e=this.headerWrap.querySelector("#header");null!==e&&(this.transitionDuration=parseFloat(n.getComputedStyle(e).getPropertyValue("transition-duration")),this.transitionDuration<10)&&(this.transitionDuration*=1e3),0===this.transitionDuration&&(this.transitionDuration=null)}}))},disable(){if(!0===this.active){if(0===this.transitionDuration||null===this.transitionDuration)this.active=!1;else{const e=this.headerWrap.querySelector("#header"),i=()=>{e.tfOff("transitionend",i,{passive:!0,once:!0}),clearTimeout(a),this.active=!1},a=setTimeout(i,this.transitionDuration+10);e.tfOn("transitionend",i,{passive:!0,once:!0})}d.body.classList.remove("fixed-header-on"),this.headerWrap.classList.remove("fixed-header"),0<this.normalHeight&&("relative"===this.type||"static"===this.type)&&(this.headerWrap.parentNode.style.paddingTop="");const t=this.headerWrap.tfClass("tf_carousel");for(let e=t.length-1;-1<e;--e){const s=t[e].swiper;s&&setTimeout(()=>{s.autoplay.running&&s.autoplay.pause(),s.slideToClosest(100),s.autoplay.running&&s.autoplay.run()},50)}}}},o.on("tf_fixed_header_init",e=>{!1===o.is_builder_active&&ThemifyFixedHeader.init(e)}).on("tf_fixed_header_enable",()=>{!1===o.is_builder_active&&ThemifyFixedHeader.enable()}).on("tf_fixed_header_disable",()=>{ThemifyFixedHeader.disable()}).on("tf_fixed_header_remove_revelaing",()=>{null!==ThemifyFixedHeader.headerWrap&&ThemifyFixedHeader.headerWrap.classList.remove("header_hidden")})})(Themify,document,window);
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка