PluginProbe
Gutenify – Visual Site Builder Blocks & Starter Templates / 1.6.5
Gutenify – Visual Site Builder Blocks & Starter Templates v1.6.5
1.9.0 1.8.0 1.7.0 1.6.6 1.6.5 1.6.4 trunk 0.0.1 0.0.2 0.0.3 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 All 74 releases
gutenify / core / dist / blocks / stacking-cards / view-script.js

view-script.js in Gutenify – Visual Site Builder Blocks & Starter Templates 1.6.5, at core/dist/blocks/stacking-cards/view-script.js

1 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (()=>{"use strict";var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const e=window.jQuery;t.n(e)()((function(t){let e=!1;const n=".gutenify-stacking-cards-container",i=()=>{const i=t(window).scrollTop();t(n).each((function(){var e;const n=t(this),o=n.find(".gutenify-stacking-card-item"),a=n.data("stacking-mode"),s=n.data("top-offset")||"50px",r=parseFloat(n.data("scale-intensity"))||.05,c=parseFloat(n.data("fade-intensity")),d=isNaN(c)||.1===c?1:c;if(!0===n.data("disable-mobile")&&window.innerWidth<768)return o.css({transform:"none",opacity:"1",position:"relative",top:"0","z-index":""}),void n.css("min-height","");const l=t=>{if(!t&&0!==t)return null;if("number"==typeof t)return t;const e=parseFloat(t);if(isNaN(e))return null;if("string"==typeof t){if(t.includes("vh"))return e*window.innerHeight/100;if(t.includes("vw"))return e*window.innerWidth/100;if(t.includes("rem")||t.includes("em"))return e*parseFloat(getComputedStyle(document.documentElement).fontSize);if(t.includes("%"))return e*window.innerHeight/100}return e},u=null!==(e=l(s))&&void 0!==e?e:50,f=n.offset().top;let h=n.data("stacking-metrics");h&&!n.data("needs-recalc")||(h={totalHeight:0,cardHeights:[],originalTops:[]},o.each((function(){const e=t(this),n=e[0].style.transform;e.css("transform","none"),h.originalTops.push(e.offset().top);const i=e.outerHeight(!0);h.cardHeights.push(i),h.totalHeight+=i,e.css("transform",n)})),n.data("stacking-metrics",h),n.data("needs-recalc",!1)),n.css("min-height",h.totalHeight+"px");const g=f+h.totalHeight;o.each((function(e){var n;const s=t(this),c=(h.cardHeights[e],h.originalTops[e]);s.css("z-index",e+1);const f=null!==(n=l(s.data("sticky-offset")))&&void 0!==n?n:u,m=i+f;let p=0;m>c&&(p=m-c);const w=g-(c+s.outerHeight(!1));p>w&&(p=Math.max(0,w));let y=`translateY(${p}px)`,v=1;if(e<o.length-1&&"normal"!==a){var H;const t=h.originalTops[e+1],n=null!==(H=l(o.eq(e+1).data("sticky-offset")))&&void 0!==H?H:u,f=Math.max(t,i+n),g=c+p+s.outerHeight(!1),m=s.outerHeight(!1),w=g-f,k=Math.max(0,Math.min(1,w/m));"scale"===a?(y+=` scale(${1-k*r})`,s.css("transform-origin","top center")):"fade"===a&&(v=1-k*d)}s.css({transform:y,opacity:v,position:"relative",top:"0"})}))})),e=!1},o=()=>{e||(window.requestAnimationFrame(i),e=!0)},a=()=>{t(n).data("needs-recalc",!0),o()};t(window).on("scroll.stackingCards",o),t(window).on("resize.stackingCards",a),setTimeout(a,100),setTimeout(a,500),setTimeout(a,1500)}))})();