Subversion Repositories wpShopGermany4

Compare Revisions

Ignore whitespace Rev 8010 → Rev 8196

/js/dsimagezoom.min.js
0,0 → 1,0
class DsImageZoom{static destroy(t){void 0===t&&(t=document.getElementsByClassName("ds_image_zoom"));for(const e of t){const t=e.getElementsByTagName("img")[0];e.classList.remove("attached"),e.setAttribute("style",""),t.setAttribute("style","")}}static init(t){void 0===t&&(t=document.getElementsByClassName("ds_image_zoom"));for(const e of t){const t=e.getElementsByTagName("img")[0];t.onload=()=>{const s=t.getBoundingClientRect().width,i=t.getBoundingClientRect().height,a=.5*s;e.setAttribute("data-image-width",s),e.setAttribute("data-image-height",i),e.setAttribute("data-factor",a),e.style.width=s+"px",e.style.height=i+"px",t.style.width=s+"px",t.style.height=i+"px",e.classList.add("attached"),e.addEventListener("mousemove",(o=>{t.style.width=s+a+"px",t.style.height=i+a+"px";const n=(o.x-e.getBoundingClientRect().x)/s,d=(o.y-e.getBoundingClientRect().y)/s;t.style.left=-1*a*n+"px",t.style.top=-1*a*d+"px"})),e.addEventListener("mousein",(t=>{})),e.addEventListener("mouseout",(e=>{t.style.width=s+"px",t.style.height=i+"px",t.style.left="0px",t.style.top="0px"}))},t.setAttribute("src",t.getAttribute("data-src"))}}}