PluginProbe ʕ •ᴥ•ʔ
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More / trunk
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More vtrunk
4.1.0 4.0.9 4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 trunk 1.0.0 2.0.0 2.0.1 2.0.2 2.0.3 3.0 3.0.1 3.0.2 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.2.0 3.2.1 3.2.2 3.2.4 3.2.5 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.4.5 3.4.6 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.6 3.5.7 3.5.8 3.5.9 3.6.0 3.6.1 3.6.2 3.7.0 3.7.1
superb-blocks / assets / js / dynamic-blocks / sticky.js
superb-blocks / assets / js / dynamic-blocks Last commit date
accordion.js 2 weeks ago add-to-cart.js 2 weeks ago animated-heading.js 2 weeks ago block-animations.js 2 weeks ago carousel.js 2 weeks ago count-animations.js 2 weeks ago countdown.js 2 weeks ago form.js 2 weeks ago popup.js 2 weeks ago progress-bar.js 2 weeks ago reveal-button.js 2 weeks ago sticky.js 2 weeks ago table-of-contents-smooth-scroll.js 2 weeks ago typing-animations.js 2 weeks ago
sticky.js
1 lines
1 !function(){"use strict";var t=[],e=!1;function i(t){var e=window.getComputedStyle(t.el);t.placeholder.style.marginTop=e.marginTop,t.placeholder.style.marginRight=e.marginRight,t.placeholder.style.marginBottom=e.marginBottom,t.placeholder.style.marginLeft=e.marginLeft,t.placeholder.style.height=t.naturalHeight+"px",t.placeholder.style.width=t.naturalWidth+"px"}function n(t){if(t.__spbaddStickyItem)return t.__spbaddStickyItem;var e,i="bottom"===t.getAttribute("data-spbadd-sticky-position")?"bottom":"top",n=t.getAttribute("data-spbadd-sticky-scope")||"screen",l=(e=t.getAttribute("data-spbadd-sticky-disable"))?e.split(",").map((function(t){return t.trim()})).filter(Boolean):[],s=t.getBoundingClientRect(),r=function(t){var e=t.getBoundingClientRect(),i=window.getComputedStyle(t),n=document.createElement("li"===t.tagName.toLowerCase()?"li":"div");return n.className="spbadd-sticky-placeholder",n.setAttribute("aria-hidden","true"),n.style.visibility="hidden",n.style.pointerEvents="none",n.style.width=e.width+"px",n.style.height=e.height+"px",n.style.marginTop=i.marginTop,n.style.marginRight=i.marginRight,n.style.marginBottom=i.marginBottom,n.style.marginLeft=i.marginLeft,n.style.display="inline"===i.display?"inline-block":i.display,t.parentNode.insertBefore(n,t),n}(t);t.style.position="fixed",t.style.left=s.left+"px",t.style.top="0px",t.style.width=s.width+"px",t.style.margin="0",t.style.willChange="transform";var o=function(t,e){if("screen"===e)return null;for(var i=t.parentElement,n=null,a=null;i;){var l=i.className;if("string"==typeof l&&/(^|\s)wp-block(\s|$|-)/.test(l)&&(n||(n=i),a=i),"MAIN"===i.tagName||i.classList&&(i.classList.contains("entry-content")||i.classList.contains("wp-site-blocks")))break;i=i.parentElement}return"parent"===e?n:"top-level"===e?a:null}(r,n),d={el:t,placeholder:r,position:i,scope:n,disable:l,container:o,naturalHeight:s.height,naturalWidth:s.width,active:!0,offset:0};return t.__spbaddStickyItem=d,t.classList.add("spbadd-sticky-ready"),a(d),d}function a(t){var e=window.getComputedStyle(t.el).getPropertyValue("--spbadd-sticky-offset");t.offset=function(t,e){if(!t)return 0;if(""===(t=String(t).trim())||"0"===t)return 0;if(/^-?\d*\.?\d+$/.test(t))return parseFloat(t);var i=document.createElement("div");i.style.position="absolute",i.style.visibility="hidden",i.style.pointerEvents="none",i.style.width="0",i.style.height=t;var n=e&&e.parentNode||document.body;n.appendChild(i);var a=i.getBoundingClientRect().height;return n.removeChild(i),isNaN(a)?0:a}(e,t.placeholder||t.el)}function l(t){return"number"==typeof t.offset?t.offset:0}function s(t,e){if(t.wasStuck!==e){t.wasStuck=e,e?t.el.classList.add("spbadd-sticky-stuck"):t.el.classList.remove("spbadd-sticky-stuck");try{t.el.dispatchEvent(new CustomEvent("spbadd-sticky-state",{bubbles:!1,detail:{stuck:e,position:t.position,offset:t.offset}}))}catch(t){}}}function r(t){var e,i=t.el,n=t.placeholder,r=(e=window.innerWidth)<=768?"mobile":e<=1024?"tablet":"desktop";if(-1!==t.disable.indexOf(r))return t.active&&(t.active=!1,i.style.position="static",i.style.transform="",i.style.left="",i.style.top="",i.style.width="",i.style.zIndex="",n.style.display="none"),void s(t,!1);t.active||(t.active=!0,n.style.display="",i.style.position="fixed",i.style.top="0px",i.style.margin="0"),a(t);var o=n.getBoundingClientRect();t.naturalHeight=o.height||t.naturalHeight,t.naturalWidth=o.width||t.naturalWidth,i.style.left=o.left+"px",i.style.width=o.width+"px",i.style.zIndex=String(function(t){var e=window.getComputedStyle(t),i=parseInt(e.getPropertyValue("--spbadd-sticky-z"),10);return isNaN(i)?10:i}(i));var d,p,c=window.innerHeight,y=i.offsetHeight||t.naturalHeight;function u(e){if("top"===t.position)if(p=o.top<e){if(d=e,t.container){var i=t.container.getBoundingClientRect().bottom-y;i<d&&(d=i)}}else d=o.top;else{var n=c-e,a=o.bottom;if(p=a>n){if(d=n-y,t.container){var l=t.container.getBoundingClientRect().top;l>d&&(d=l)}}else d=o.top}}var f=l(t);u(f),i.style.transform="translateY("+d+"px)",s(t,p),a(t);var g=l(t);g!==f&&(u(g),i.style.transform="translateY("+d+"px)")}function o(){e=!1;for(var i=0;i<t.length;i++)r(t[i])}function d(){e||(e=!0,window.requestAnimationFrame(o))}function p(){for(var e=0;e<t.length;e++){var n=t[e];if(n.active){var l=n.el.style.transform;n.el.style.transform="",n.el.style.position="static",n.el.style.left="",n.el.style.top="",n.el.style.width="";var s=n.el.getBoundingClientRect();n.naturalHeight=s.height,n.naturalWidth=s.width,i(n),n.el.style.position="fixed",n.el.style.top="0px",n.el.style.margin="0",n.el.style.transform=l,a(n)}}d()}function c(){var e=document.querySelectorAll('[data-spbadd-sticky="true"]');if(e.length){for(var i=0;i<e.length;i++){var a=n(e[i]);a&&t.push(a)}t.length&&(window.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",p,{passive:!0}),d())}}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",c):c()}();