From e639d95ce2e8a57beda5777beea9cd899fd2c311 Mon Sep 17 00:00:00 2001 From: Daniel Schmitzer Date: Mon, 16 Jan 2023 09:23:42 +0000 Subject: Feature: standard3.phtml (Slider und Zoom) git-svn-id: https://[internal]/wordpress/plugins/wpsg4@8196 0d5edaf7-2b12-4e95-93f4-047927463d4b --- views/js/dsimagezoom.min.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 views/js/dsimagezoom.min.js (limited to 'views/js') diff --git a/views/js/dsimagezoom.min.js b/views/js/dsimagezoom.min.js new file mode 100644 index 0000000..7748583 --- /dev/null +++ b/views/js/dsimagezoom.min.js @@ -0,0 +1 @@ +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"))}}} -- cgit v1.2.3