Files
acrib.es/wp-content/plugins/kadence-blocks/includes/assets/js/jarallax.min.js

5 lines
10 KiB
JavaScript
Raw Normal View History

/*!
* Jarallax v2.1.3 (https://github.com/nk-o/jarallax)
* Copyright 2022 nK <https://nkdev.info>
* Licensed under MIT (https://github.com/nk-o/jarallax/blob/master/LICENSE)
*/!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):(a="undefined"==typeof globalThis?a||self:globalThis).jarallax=b()}(this,function(){"use strict";function j(a){"complete"===document.readyState||"interactive"===document.readyState?a():document.addEventListener("DOMContentLoaded",a,{capture:!0,once:!0,passive:!0})}function e(){a=m.innerWidth||document.documentElement.clientWidth,n?(!t&&document.body&&(t=document.createElement("div"),t.style.cssText="position: fixed; top: -9999px; left: 0; height: 100vh; width: 0;",document.body.appendChild(t)),o=(t?t.clientHeight:0)||m.innerHeight||document.documentElement.clientHeight):o=m.innerHeight||document.documentElement.clientHeight}function k(){return{width:a,height:o}}function c(){if(!v.length)return;const{width:b,height:d}=k();v.forEach((c,e)=>{const{instance:f,oldData:g}=c;if(f.isVisible()){const a=f.$item.getBoundingClientRect(),h={width:a.width,height:a.height,top:a.top,bottom:a.bottom,wndW:b,wndH:d},i=!g||g.wndW!==h.wndW||g.wndH!==h.wndH||g.width!==h.width||g.height!==h.height,j=i||!g||g.top!==h.top||g.bottom!==h.bottom;v[e].oldData=h,i&&f.onResize(),j&&f.onScroll()}}),m.requestAnimationFrame(c)}let d="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window;var m=d,q={type:"scroll",speed:.5,containerClass:"jarallax-container",imgSrc:null,imgElement:".jarallax-img",imgSize:"cover",imgPosition:"50% 50%",imgRepeat:"no-repeat",keepImg:!1,elementInViewport:null,zIndex:-100,disableParallax:!1,onScroll:null,onInit:null,onDestroy:null,onCoverImage:null,videoClass:"jarallax-video",videoSrc:null,videoStartTime:0,videoEndTime:0,videoVolume:0,videoLoop:!0,videoPlayOnlyVisible:!0,videoLazyLoading:!0,disableVideo:!1,onVideoInsert:null,onVideoWorkerInit:null};const{navigator:i}=m,n=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(i.userAgent);let a,o,t;e(),m.addEventListener("resize",e),m.addEventListener("orientationchange",e),m.addEventListener("load",e),j(()=>{e()});const v=[],p=new m.IntersectionObserver(a=>{a.forEach(a=>{a.target.jarallax.isElementInViewport=a.isIntersecting})},{rootMargin:"50px"}),{navigator:g}=m;let u=0;class h{constructor(b,c){const d=this;d.instanceID=u,u+=1,d.$item=b,d.defaults={...q};const f=d.$item.dataset||{},h={};if(Object.keys(f).forEach(a=>{const b=a.substr(0,1).toLowerCase()+a.substr(1);b&&void 0!==d.defaults[b]&&(h[b]=f[a])}),d.options=d.extend({},d.defaults,h,c),d.pureOptions=d.extend({},d.options),Object.keys(d.options).forEach(a=>{"true"===d.options[a]?d.options[a]=!0:"false"===d.options[a]&&(d.options[a]=!1)}),d.options.speed=Math.min(2,Math.max(-1,parseFloat(d.options.speed))),"string"==typeof d.options.disableParallax&&(d.options.disableParallax=new RegExp(d.options.disableParallax)),d.options.disableParallax instanceof RegExp){const a=d.options.disableParallax;d.options.disableParallax=()=>a.test(g.userAgent)}if("function"!=typeof d.options.disableParallax&&(d.options.disableParallax=()=>!1),"string"==typeof d.options.disableVideo&&(d.options.disableVideo=new RegExp(d.options.disableVideo)),d.options.disableVideo instanceof RegExp){const a=d.options.disableVideo;d.options.disableVideo=()=>a.test(g.userAgent)}"function"!=typeof d.options.disableVideo&&(d.options.disableVideo=()=>!1);let a=d.options.elementInViewport;a&&"object"==typeof a&&void 0!==a.length&&([a]=a),a instanceof Element||(a=null),d.options.elementInViewport=a,d.image={src:d.options.imgSrc||null,$container:null,useImgTag:!1,position:"fixed"},d.initImg()&&d.canInitParallax()&&d.init()}css(a,b){return function(a,b){return"string"==typeof b?m.getComputedStyle(a).getPropertyValue(b):(Object.keys(b).forEach(c=>{a.style[c]=b[c]}),a)}(a,b)}extend(a,...b){return function(a,...b){return a=a||{},Object.keys(b).forEach(c=>{b[c]&&Object.keys(b[c]).forEach(d=>{a[d]=b[c][d]})}),a}(a,...b)}getWindowData(){const{width:a,height:b}=k();return{width:a,height:b,y:document.documentElement.scrollTop}}initImg(){const a=this;let b=a.options.imgElement;retu