You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
2.1 KiB
2 lines
2.1 KiB
import{e as elementChildren}from"../shared/utils.min.mjs";function Parallax(a){let{swiper:r,extendParams:e,on:t}=a;e({parallax:{enabled:!1}});const l=(a,e)=>{const{rtl:t}=r,l=t?-1:1,s=a.getAttribute("data-swiper-parallax")||"0";let p=a.getAttribute("data-swiper-parallax-x"),i=a.getAttribute("data-swiper-parallax-y");const d=a.getAttribute("data-swiper-parallax-scale"),n=a.getAttribute("data-swiper-parallax-opacity"),o=a.getAttribute("data-swiper-parallax-rotate");if(p||i?(p=p||"0",i=i||"0"):r.isHorizontal()?(p=s,i="0"):(i=s,p="0"),p=p.indexOf("%")>=0?parseInt(p,10)*e*l+"%":p*e*l+"px",i=i.indexOf("%")>=0?parseInt(i,10)*e+"%":i*e+"px",null!=n){const r=n-(n-1)*(1-Math.abs(e));a.style.opacity=r}let x=`translate3d(${p}, ${i}, 0px)`;if(null!=d){x+=` scale(${d-(d-1)*(1-Math.abs(e))})`}if(o&&null!=o){x+=` rotate(${o*e*-1}deg)`}a.style.transform=x},s=()=>{const{el:a,slides:e,progress:t,snapGrid:s}=r;elementChildren(a,"[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]").forEach((a=>{l(a,t)})),e.forEach(((a,e)=>{let p=a.progress;r.params.slidesPerGroup>1&&"auto"!==r.params.slidesPerView&&(p+=Math.ceil(e/2)-t*(s.length-1)),p=Math.min(Math.max(p,-1),1),a.querySelectorAll("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale], [data-swiper-parallax-rotate]").forEach((a=>{l(a,p)}))}))};t("beforeInit",(()=>{r.params.parallax.enabled&&(r.params.watchSlidesProgress=!0,r.originalParams.watchSlidesProgress=!0)})),t("init",(()=>{r.params.parallax.enabled&&s()})),t("setTranslate",(()=>{r.params.parallax.enabled&&s()})),t("setTransition",((a,e)=>{r.params.parallax.enabled&&function(a){void 0===a&&(a=r.params.speed);const{el:e}=r;e.querySelectorAll("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]").forEach((r=>{let e=parseInt(r.getAttribute("data-swiper-parallax-duration"),10)||a;0===a&&(e=0),r.style.transitionDuration=`${e}ms`}))}(e)}))}export{Parallax as default};
|
|
//# sourceMappingURL=parallax.min.mjs.map
|