Reveal captions over photographs
Open a portrait, read its caption and close before moving on. Make the same caption reachable by keyboard and touch.
Why can a navbar trigger start at 600 when the page opens 600 pixels down?
For an animation that always spans the first 120 document pixels, use numeric start 0 and end 120. A fixed navbar used as a geometric trigger can shift the initial measurement. The GSAP maintainer proposed the numeric range.
We scrolled to 0, 600 and 960 before loading GSAP 3.12.5, read both trigger ranges, and measured again after a global refresh.
Compare results, scope and replay code
Initial ranges were 600–720 versus 0–120, then 960–1080 versus 0–120. After global refresh, both definitions yielded 0–120 in this version.
The maintainer supplied the original fix and the author confirmed it. These measurements add version-specific before/after data. The initial logo flash is a separate issue.
gsap.to('.logo', {width: 365, scrollTrigger: {start: 0, end: 120, scrub: 0.75}}); Tested in Chrome 157.0.8103.79. In a clean directory with Node.js 22 or later run, in order, npm install playwright gsap@3.12.5 → npx playwright install chromium → node weswoo-trigger-origin.cjs.
Deep-link to the last grid group, disable motion and reload. A group left transparent calls for checking initialization and static fallback without requiring a trip to the top.
The grid started three animations. If a card keeps moving after pause, check that the controller reached all three.
Reproduce the test and inspect the readings
Play, pause and resume while counting running card animations.
- 908 and 316 px, default motion
- 3 then 0 then 3
- 908 and 316 px, reduced motion
- 0 then 0 then 0
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
View the phone and desktop observations
WESWOO · 24 November 2026. We enabled reduced motion at phone width and used the default motion setting at desktop width. These observations come from the live example.
| Window / preview width | Action | Observed result |
|---|---|---|
| 390 / 316 px | Read animation state after playback starts | At sampling time, the Web Animations API reported 0 running animations. |
| 1440 / 908 px | Read animation state after playback starts | At sampling time, the Web Animations API reported 3 running animations. |
Preparing preview
How the effect works
Choose an order that helps recognition
Raw material, making and finished pottery can establish a useful viewing sequence. Peer works can follow their existing order with stable names and descriptions. Build a useful grid first; after the entrance it should remain a normal browsable collection.
Leave the complete gallery after the reveal
The example reveals images with clipping and opacity when played. A page can run once on entry and stop observing afterwards, rather than repeatedly removing images as readers scroll back. Reserve real-image dimensions so loading does not displace content. Reduced motion shows the group directly and keeps related links.
Example source code
View 3 source filesHTML · CSS · MJS
<section class="fx" data-effect="reveal-grid"><small>13 / A CONTROLLED ENTRANCE</small><h2>DETAILS MATTER.</h2><div class="reveal-grid"><div class="art" data-art="1" aria-label="SHOKZ website project screen" role="img"></div><div class="art" data-art="2" aria-label="TERMINO website project screen" role="img"></div><div class="art" data-art="3" aria-label="INIU website project screen" role="img"></div></div></section>
*{box-sizing:border-box}body{margin:0;background:#111211;color:#f4f0e7;font:14px/1.55 Arial,Helvetica,sans-serif}button,input{font:inherit}button{cursor:pointer;border:1px solid #ffffff50;border-radius:99px;padding:11px 18px;color:inherit;background:transparent;min-height:42px}button:hover{background:#ffffff15}button:focus-visible,a:focus-visible,input:focus-visible,[tabindex]:focus-visible{outline:3px solid #c6fc6b;outline-offset:4px}.fx{position:relative;min-height:500px;padding:34px;overflow:hidden;display:grid;align-content:center;gap:20px;isolation:isolate;background:#111211}.fx h2,.fx h3,.fx p{margin:0}.fx h2{font-size:clamp(36px,7vw,82px);font-weight:750;letter-spacing:-.065em;line-height:.98}.fx small{letter-spacing:.18em;color:#c2c3b9;font-size:10px}.fx>small{position:relative;z-index:2;align-self:start}.fx p{max-width:46ch}.fx:after{content:'WESWOO / INTERACTION STUDY';position:absolute;bottom:12px;right:23px;font-size:8px;letter-spacing:.18em;color:inherit;opacity:.45;pointer-events:none}.art{position:relative;min-height:240px;border-radius:3px;overflow:hidden;background-color:#ea754e;background-size:cover;background-position:center}.art:before,.art:after{content:none!important}.hint{font-size:11px;color:#b5b8ad}.controls{display:flex;gap:8px;flex-wrap:wrap}.scroller{height:385px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#b7b9a6 #292a26;border-radius:3px;position:relative;outline-offset:2px;overscroll-behavior-y:contain}.spacer{height:120px;display:grid;place-items:center;color:#bfc1b5;font-size:11px;letter-spacing:.04em}.fx [hidden]{display:none!important}.fx[data-playing=false] *{animation-play-state:paused!important}.fx button[aria-pressed=true]{background:#c6fc6b;color:#171a12}.fx a{color:inherit;text-underline-offset:4px}.fx[data-reduced-motion=true] *,.fx[data-reduced-motion=true] *:before,.fx[data-reduced-motion=true] *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}
@media(max-width:500px){.fx{padding:22px;min-height:460px;gap:18px}.fx h2{font-size:43px}.fx>small{font-size:8px}.art{min-height:215px}.scroller{height:355px}.fx:after{font-size:7px;right:16px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
.reveal-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.reveal-grid .art{min-height:190px}.reveal-grid .art:before{left:5%;width:100px;height:100px}@media(max-width:500px){.reveal-grid{gap:8px}.reveal-grid .art{min-height:150px}.reveal-grid .art:before{width:60px;height:80px;border-width:12px}}
.fx[data-effect=reveal-grid]{background:#e8e5dc;color:#282a24;gap:22px}.fx[data-effect=reveal-grid] small{color:#656757}.fx[data-effect=reveal-grid] h2{font-size:clamp(34px,5vw,56px)}.fx[data-effect=reveal-grid] .reveal-grid{align-items:center;gap:12px}.fx[data-effect=reveal-grid] .reveal-grid .art{height:285px;min-height:0}.fx[data-effect=reveal-grid] .reveal-grid .art:nth-child(2){height:325px}.fx[data-reduced-motion=true] .stack-card{position:relative;top:0!important}.fx[data-reduced-motion=true] .horizontal-story{height:370px}.fx[data-reduced-motion=true] .horizontal-pin{overflow-x:auto}.fx[data-reduced-motion=true] .horizontal-track{transform:none!important}.fx[data-reduced-motion=true] .story-grid{grid-template-columns:1fr}.fx[data-reduced-motion=true] .story-image{position:static}.fx[data-reduced-motion=true] .loop-window{overflow-x:auto}.fx[data-reduced-motion=true] .loop-set[aria-hidden=true]{display:none}
@media(max-width:600px){.fx[data-effect=reveal-grid] .reveal-grid .art{height:220px}.fx[data-effect=reveal-grid] .reveal-grid .art:nth-child(2){height:265px}}
/* Real website project imagery; rights remain with the project owners. */
.art{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp");background-size:cover;background-position:center} .art[data-art="1"]{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp");background-size:cover;background-position:center} .art[data-art="2"]{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/termino-preview.webp");background-size:cover;background-position:center} .art[data-art="3"]{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp");background-size:cover;background-position:center} .art:before,.art:after{content:none!important}// WESWOO original educational example; no third-party runtime required.
export function mountEffect(root, {reducedMotion=false}={}) {
const reduced=reducedMotion||matchMedia('(prefers-reduced-motion: reduce)').matches;
root.dataset.reducedMotion=String(reduced);
const life=new AbortController(), animations=[];
let active=false, started=false;
const on=(node,type,fn,options={})=>node.addEventListener(type,fn,{...options,signal:life.signal});
const animate=(node,frames,options)=>{
if(reduced)return null;
const animation=node.animate(frames,options);animations.push(animation);return animation;
};
let start=()=>{}, stop=()=>{}, cleanup=()=>{};
start=()=>root.querySelectorAll('.reveal-grid .art').forEach((card,i)=>animate(card,[{clipPath:'inset(100% 0 0 0)',opacity:.3},{clipPath:'inset(0 0 0 0)',opacity:1}],{duration:900,delay:i*160,fill:'both',easing:'cubic-bezier(.2,.7,.2,1)'}));
root.dataset.playing='false';
return {
resume(){active=true;root.dataset.playing='true';if(!started){started=true;start();}animations.forEach(a=>a.play());root.dispatchEvent(new Event('ww:resume'));},
pause(){active=false;root.dataset.playing='false';animations.forEach(a=>a.pause());stop();},
destroy(){active=false;life.abort();animations.forEach(a=>a.cancel());cleanup();}
};
}
Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- A brand or construction Section. Real images need explicit dimensions, useful alternatives and offscreen lazy loading.
Interaction
- Reveal each image with clip-path and opacity in source order. The play button triggers this example once; a page may use a one-shot IntersectionObserver and disconnect it afterward.
Touch and accessibility
- Reduced motion shows every frame statically. On phones, reduce spacing or reuse the theme carousel; essential meaning must not depend on the entrance.
Before launch
Integration files
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Reference on the WESWOO case siteShopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseMix portrait, landscape and unknown-ratio assets and inspect late image loading. Check row stability separately from subject retention and verify the full detail in the enlarged view.
Closing the enlarged image returned focus to its original trigger. The final reading catches dialogs that close visually but lose the keyboard position.
Reproduce the test and inspect the readings
Focus the first image, open it, then close it. Check open state, open state after close and focus restoration.
- 908 and 316 px, both preferences
- true then false then true
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
View the phone and desktop observations
WESWOO · 24 November 2026. We enabled reduced motion at phone width and used the default motion setting at desktop width. These observations come from the live example.
| Window / preview width | Action | Observed result |
|---|---|---|
| 390 / 316 px | Open the image and use its close control | The dialog opened with the accessible name “Selected website project screen”. Its close control dismissed it. |
| 1440 / 908 px | Open the image and use its close control | The dialog opened with the accessible name “Selected website project screen”. Its close control dismissed it. |
Preparing preview
How the effect works
Proportion carries information
A craft case may need a wide room view alongside a portrait detail. Cropping both into identical squares can remove useful composition. Proportional widths let them share a row while retaining their character, with descriptions explaining their relationship to the project.
Replace demo ratios with image metadata
The example allocates width by aspect ratio and opens the chosen visual and description in a native dialog. Read real image proportions and keep image, title and description in one block. Fixed demo ratios are not universal sizes. Phones can split the row for recognisable images; closing returns to the original entry for continued comparison.
Example source code
View 3 source filesHTML · CSS · MJS
<section class="fx" data-effect="justified-gallery"><small>23 / DIFFERENT RATIOS, ONE RHYTHM</small><div class="justified"><button type="button" data-view="1" aria-label="Open SHOKZ website screen" style="--ratio:1.45"><span class="art" data-art="1"></span><span>SHOKZ / 01</span></button><button type="button" data-view="2" aria-label="Open TERMINO website screen" style="--ratio:.8"><span class="art" data-art="2"></span><span>TERMINO / 02</span></button><button type="button" data-view="3" aria-label="Open INIU website screen" style="--ratio:1.1"><span class="art" data-art="3"></span><span>INIU / 03</span></button></div><p class="hint">Three website project screens align in a row. Select one to inspect it.</p><dialog aria-label="Selected website project screen"><button type="button" data-close>Close ×</button><div class="art" data-art="1" role="img" aria-label="Selected website project screen"></div><p role="status">SHOKZ website screen</p></dialog></section>
*{box-sizing:border-box}body{margin:0;background:#111211;color:#f4f0e7;font:14px/1.55 Arial,Helvetica,sans-serif}button,input{font:inherit}button{cursor:pointer;border:1px solid #ffffff50;border-radius:99px;padding:11px 18px;color:inherit;background:transparent;min-height:42px}button:hover{background:#ffffff15}button:focus-visible,a:focus-visible,input:focus-visible,[tabindex]:focus-visible{outline:3px solid #c6fc6b;outline-offset:4px}.fx{position:relative;min-height:500px;padding:34px;overflow:hidden;display:grid;align-content:center;gap:20px;isolation:isolate;background:#111211}.fx h2,.fx h3,.fx p{margin:0}.fx h2{font-size:clamp(36px,7vw,82px);font-weight:750;letter-spacing:-.065em;line-height:.98}.fx small{letter-spacing:.18em;color:#c2c3b9;font-size:10px}.fx>small{position:relative;z-index:2;align-self:start}.fx p{max-width:46ch}.fx:after{content:'WESWOO / INTERACTION STUDY';position:absolute;bottom:12px;right:23px;font-size:8px;letter-spacing:.18em;color:inherit;opacity:.45;pointer-events:none}.art{position:relative;min-height:240px;border-radius:3px;overflow:hidden;background-color:#ea754e;background-size:cover;background-position:center}.art:before,.art:after{content:none!important}.hint{font-size:11px;color:#b5b8ad}.controls{display:flex;gap:8px;flex-wrap:wrap}.scroller{height:385px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#b7b9a6 #292a26;border-radius:3px;position:relative;outline-offset:2px;overscroll-behavior-y:contain}.spacer{height:120px;display:grid;place-items:center;color:#bfc1b5;font-size:11px;letter-spacing:.04em}.fx [hidden]{display:none!important}.fx[data-playing=false] *{animation-play-state:paused!important}.fx button[aria-pressed=true]{background:#c6fc6b;color:#171a12}.fx a{color:inherit;text-underline-offset:4px}.fx[data-reduced-motion=true] *,.fx[data-reduced-motion=true] *:before,.fx[data-reduced-motion=true] *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}
@media(max-width:500px){.fx{padding:22px;min-height:460px;gap:18px}.fx h2{font-size:43px}.fx>small{font-size:8px}.art{min-height:215px}.scroller{height:355px}.fx:after{font-size:7px;right:16px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
.fx{background:#ebe7dc;color:#2a2c23}.fx small,.hint{color:#60674f}.justified{display:flex;gap:10px;align-items:stretch;min-width:0}.justified>button{flex:var(--ratio) 1 0;min-width:0;padding:0;border:0;border-radius:0;position:relative;overflow:hidden;background:transparent}.justified .art{display:block;height:300px;min-height:0;transition:transform .6s cubic-bezier(.2,.8,.2,1)}.justified>button>span:last-child{position:absolute;bottom:13px;left:10px;background:#f1ede3e6;padding:6px 8px;font-size:9px;color:#282d22}.fx[data-playing=true] .justified>button:hover .art,.fx[data-playing=true] .justified>button:focus-visible .art{transform:scale(1.07)}dialog{width:calc(100% - 28px);max-width:720px;border:0;background:#ebe7dc;color:#2a2c23;padding:18px;border-radius:4px}dialog::backdrop{background:#080c11db}dialog .art{height:min(52vh,360px);margin:15px 0;min-height:200px}dialog p{font-size:12px}dialog button{border-color:#777b68}@media(max-width:500px){.justified{gap:7px}.justified .art{height:280px}.justified>button>span:last-child{font-size:7px;left:5px;padding:5px}}
/* Real website project imagery; rights remain with the project owners. */
.art{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp");background-size:cover;background-position:center} .art[data-art="1"]{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp");background-size:cover;background-position:center} .art[data-art="2"]{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/termino-preview.webp");background-size:cover;background-position:center} .art[data-art="3"]{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp");background-size:cover;background-position:center} .art:before,.art:after{content:none!important}// WESWOO original educational example; no third-party runtime required.
export function mountEffect(root, {reducedMotion=false}={}) {
const reduced=reducedMotion||matchMedia('(prefers-reduced-motion: reduce)').matches;
root.dataset.reducedMotion=String(reduced);
const life=new AbortController(), animations=[];
let active=false, started=false;
const on=(node,type,fn,options={})=>node.addEventListener(type,fn,{...options,signal:life.signal});
const animate=(node,frames,options)=>{
if(reduced)return null;
const animation=node.animate(frames,options);animations.push(animation);return animation;
};
let start=()=>{}, stop=()=>{}, cleanup=()=>{};
const dialog=root.querySelector('dialog'),art=dialog.querySelector('.art'),names=['SHOKZ','TERMINO','INIU'];
root.querySelectorAll('[data-view]').forEach(button=>on(button,'click',()=>{if(!active||dialog.open)return;art.dataset.art=button.dataset.view;const label=button.dataset.title||names[Number(button.dataset.view)-1]+' website screen';art.setAttribute('aria-label',label);dialog.querySelector('[role=status]').textContent=label;dialog.showModal();}));
on(root.querySelector('[data-close]'),'click',()=>dialog.close());on(dialog,'click',event=>{if(event.target===dialog){const r=dialog.getBoundingClientRect();if(event.clientX<r.left||event.clientX>r.right||event.clientY<r.top||event.clientY>r.bottom)dialog.close();}});stop=()=>{if(dialog.open)dialog.close();};cleanup=stop;
root.dataset.playing='false';
return {
resume(){active=true;root.dataset.playing='true';if(!started){started=true;start();}animations.forEach(a=>a.play());root.dispatchEvent(new Event('ww:resume'));},
pause(){active=false;root.dataset.playing='false';animations.forEach(a=>a.pause());stop();},
destroy(){active=false;life.abort();animations.forEach(a=>a.cancel());cleanup();}
};
}
Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- A craft, brand or case Section. image_1 through image_3 provide images, and their aspect_ratio sets proportional widths. The fixed demo ratios become real image metadata in Liquid.
Interaction
- Use aspect ratios as flex growth factors with reserved height. A native dialog switches the selected visual and accessible description, contains focus and restores it to the originating control after close.
Touch and accessibility
- Without scripting, original visuals and captions remain. Reduced motion removes hover zoom. The phone example is an image overview; readable peer cards should reuse the theme carousel.
Setup notes for this effect
Files: copy sections/ww-effect-justified-gallery.liquid; save this example’s JavaScript unchanged as assets/ww-effect-justified-gallery.js, and copy the shared assets/ww-effect-studio.js below. The Section includes CSS scoped to .ww-fx-host.
Data: A craft, brand or case Section. image_1 through image_3 provide images, and their aspect_ratio sets proportional widths. The fixed demo ratios become real image metadata in Liquid.
Initialization: load the selected module on the first play action. Each Section keeps its own instance; offscreen, visibility and preference changes pause it, and unload releases observers and listeners.
Delivery scope: this concrete theme example retains the local canvas scroll model. A page-driven version needs the documented Section interval adaptation. Replace images, localize controls and verify actual theme styles and devices in a duplicate theme.
Before launch
Integration files
{% comment %}
WESWOO original Section example. Copy assets/ww-effect-justified-gallery.js and assets/ww-effect-studio.js.
This preserves the local preview scroll model. A page-driven story needs the documented Section interval adaptation.
Theme Check is static validation, not a completed merchant-theme installation. Localize control strings for multilingual shops.
{% endcomment %}
<ww-effect-study class="ww-fx-host" data-effect-type="justified-gallery" id="WWEffect-{{ section.id }}" data-module-url="{{ 'ww-effect-justified-gallery.js' | asset_url }}">
<div class="ww-fx-controls"><button type="button" data-effect-toggle aria-pressed="false">Play / pause</button><span data-effect-status role="status"></span></div>
<section class="fx" data-effect="justified-gallery"><small>23 / DIFFERENT RATIOS, ONE RHYTHM</small><div class="justified"><button type="button" data-view="1" data-title="{{ section.settings.image_1.alt | default: 'Design study' | escape }}" aria-label="Open Arc design study" style="--ratio:{{ section.settings.image_1.aspect_ratio | default: 1 }}"><span class="art" data-art="1">{% if section.settings.image_1 != blank %}{{ section.settings.image_1 | image_url: width: 1600 | image_tag: widths: '360, 720, 1080, 1600', sizes: '(min-width: 990px) 50vw, 100vw', loading: 'lazy', class: 'ww-fx-image' }}{% endif %}</span><span>ARC / 01</span></button><button type="button" data-view="2" data-title="{{ section.settings.image_2.alt | default: 'Design study' | escape }}" aria-label="Open Object design study" style="--ratio:{{ section.settings.image_2.aspect_ratio | default: 1 }}"><span class="art" data-art="2">{% if section.settings.image_2 != blank %}{{ section.settings.image_2 | image_url: width: 1600 | image_tag: widths: '360, 720, 1080, 1600', sizes: '(min-width: 990px) 50vw, 100vw', loading: 'lazy', class: 'ww-fx-image' }}{% endif %}</span><span>OBJECT / 02</span></button><button type="button" data-view="3" data-title="{{ section.settings.image_3.alt | default: 'Design study' | escape }}" aria-label="Open Orbit design study" style="--ratio:{{ section.settings.image_3.aspect_ratio | default: 1 }}"><span class="art" data-art="3">{% if section.settings.image_3 != blank %}{{ section.settings.image_3 | image_url: width: 1600 | image_tag: widths: '360, 720, 1080, 1600', sizes: '(min-width: 990px) 50vw, 100vw', loading: 'lazy', class: 'ww-fx-image' }}{% endif %}</span><span>ORBIT / 03</span></button></div><p class="hint">Three proportions align into a single row. Select a study to inspect it.</p><dialog aria-label="Selected original design study"><button type="button" data-close>Close ×</button><div class="art" data-art="1" role="img" aria-label="Selected original artwork">{% if section.settings.image_1 != blank %}{{ section.settings.image_1 | image_url: width: 1600 | image_tag: widths: '360, 720, 1080, 1600', sizes: '(min-width: 990px) 50vw, 100vw', loading: 'lazy', class: 'ww-fx-image' }}{% endif %}</div><p role="status">Arc design study</p></dialog></section>
</ww-effect-study>
<script type="module" src="{{ 'ww-effect-studio.js' | asset_url }}"></script>
{% stylesheet %}
.ww-fx-host[data-effect-type="justified-gallery"] *{box-sizing:border-box}.ww-fx-host[data-effect-type="justified-gallery"]{margin:0;background:#111211;color:#f4f0e7;font:14px/1.55 Arial,Helvetica,sans-serif}.ww-fx-host[data-effect-type="justified-gallery"] button,.ww-fx-host[data-effect-type="justified-gallery"] input{font:inherit}.ww-fx-host[data-effect-type="justified-gallery"] button{cursor:pointer;border:1px solid #ffffff50;border-radius:99px;padding:11px 18px;color:inherit;background:transparent;min-height:42px}.ww-fx-host[data-effect-type="justified-gallery"] button:hover{background:#ffffff15}.ww-fx-host[data-effect-type="justified-gallery"] button:focus-visible,.ww-fx-host[data-effect-type="justified-gallery"] a:focus-visible,.ww-fx-host[data-effect-type="justified-gallery"] input:focus-visible,.ww-fx-host[data-effect-type="justified-gallery"] [tabindex]:focus-visible{outline:3px solid #c6fc6b;outline-offset:4px}.ww-fx-host[data-effect-type="justified-gallery"] .fx{position:relative;min-height:500px;padding:34px;overflow:hidden;display:grid;align-content:center;gap:20px;isolation:isolate;background:#111211}.ww-fx-host[data-effect-type="justified-gallery"] .fx h2,.ww-fx-host[data-effect-type="justified-gallery"] .fx h3,.ww-fx-host[data-effect-type="justified-gallery"] .fx p{margin:0}.ww-fx-host[data-effect-type="justified-gallery"] .fx h2{font-size:clamp(36px,7vw,82px);font-weight:750;letter-spacing:-.065em;line-height:.98}.ww-fx-host[data-effect-type="justified-gallery"] .fx small{letter-spacing:.18em;color:#c2c3b9;font-size:10px}.ww-fx-host[data-effect-type="justified-gallery"] .fx>small{position:relative;z-index:2;align-self:start}.ww-fx-host[data-effect-type="justified-gallery"] .fx p{max-width:46ch}.ww-fx-host[data-effect-type="justified-gallery"] .fx:after{content:'WESWOO / INTERACTION STUDY';position:absolute;bottom:12px;right:23px;font-size:8px;letter-spacing:.18em;color:inherit;opacity:.45;pointer-events:none}.ww-fx-host[data-effect-type="justified-gallery"] .art{position:relative;min-height:240px;border-radius:3px;overflow:hidden;background-color:#ea754e;background-size:cover;background-position:center}.ww-fx-host[data-effect-type="justified-gallery"] .art:before,.ww-fx-host[data-effect-type="justified-gallery"] .art:after{content:none!important}.ww-fx-host[data-effect-type="justified-gallery"] .hint{font-size:11px;color:#b5b8ad}.ww-fx-host[data-effect-type="justified-gallery"] .controls{display:flex;gap:8px;flex-wrap:wrap}.ww-fx-host[data-effect-type="justified-gallery"] .scroller{height:385px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#b7b9a6 #292a26;border-radius:3px;position:relative;outline-offset:2px;overscroll-behavior-y:contain}.ww-fx-host[data-effect-type="justified-gallery"] .spacer{height:120px;display:grid;place-items:center;color:#bfc1b5;font-size:11px;letter-spacing:.04em}.ww-fx-host[data-effect-type="justified-gallery"] .fx [hidden]{display:none!important}.ww-fx-host[data-effect-type="justified-gallery"] .fx[data-playing=false] *{animation-play-state:paused!important}.ww-fx-host[data-effect-type="justified-gallery"] .fx button[aria-pressed=true]{background:#c6fc6b;color:#171a12}.ww-fx-host[data-effect-type="justified-gallery"] .fx a{color:inherit;text-underline-offset:4px}.ww-fx-host[data-effect-type="justified-gallery"] .fx[data-reduced-motion=true] *,.ww-fx-host[data-effect-type="justified-gallery"] .fx[data-reduced-motion=true] *:before,.ww-fx-host[data-effect-type="justified-gallery"] .fx[data-reduced-motion=true] *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}
@media(max-width:500px){.ww-fx-host[data-effect-type="justified-gallery"] .fx{padding:22px;min-height:460px;gap:18px}.ww-fx-host[data-effect-type="justified-gallery"] .fx h2{font-size:43px}.ww-fx-host[data-effect-type="justified-gallery"] .fx>small{font-size:8px}.ww-fx-host[data-effect-type="justified-gallery"] .art{min-height:215px}.ww-fx-host[data-effect-type="justified-gallery"] .scroller{height:355px}.ww-fx-host[data-effect-type="justified-gallery"] .fx:after{font-size:7px;right:16px}}
@media(prefers-reduced-motion:reduce){.ww-fx-host[data-effect-type="justified-gallery"] *,.ww-fx-host[data-effect-type="justified-gallery"] *:before,.ww-fx-host[data-effect-type="justified-gallery"] *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}.ww-fx-host[data-effect-type="justified-gallery"] .art{background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20900%20700%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22bg%22%20x2%3D%221%22%20y2%3D%221%22%3E%3Cstop%20stop-color%3D%22%23ff764a%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23b52d29%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22chrome%22%20x2%3D%22.8%22%20y2%3D%221%22%3E%3Cstop%20stop-color%3D%22%23fff8d7%22%2F%3E%3Cstop%20offset%3D%22.26%22%20stop-color%3D%22%23b3aca6%22%2F%3E%3Cstop%20offset%3D%22.48%22%20stop-color%3D%22%23fef9e8%22%2F%3E%3Cstop%20offset%3D%22.59%22%20stop-color%3D%22%23656773%22%2F%3E%3Cstop%20offset%3D%22.82%22%20stop-color%3D%22%23d5d9d2%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23373c46%22%2F%3E%3C%2FlinearGradient%3E%3CradialGradient%20id%3D%22pad%22%3E%3Cstop%20stop-color%3D%22%2355565c%22%2F%3E%3Cstop%20offset%3D%22.75%22%20stop-color%3D%22%23191b25%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%230e1019%22%2F%3E%3C%2FradialGradient%3E%3Cfilter%20id%3D%22shadow%22%3E%3CfeGaussianBlur%20stdDeviation%3D%2223%22%2F%3E%3C%2Ffilter%3E%3C%2Fdefs%3E%3Cpath%20fill%3D%22url%28%23bg%29%22%20d%3D%22M0%200h900v700H0z%22%2F%3E%3Ccircle%20cx%3D%22770%22%20cy%3D%2280%22%20r%3D%22265%22%20fill%3D%22%23ffa873%22%20opacity%3D%22.35%22%2F%3E%3Cpath%20d%3D%22M0%20560L900%20395V700H0%22%20fill%3D%22%23f88958%22%20opacity%3D%22.24%22%2F%3E%3Cellipse%20cx%3D%22463%22%20cy%3D%22594%22%20rx%3D%22230%22%20ry%3D%2238%22%20fill%3D%22%2353272b%22%20opacity%3D%22.55%22%20filter%3D%22url%28%23shadow%29%22%2F%3E%3Cg%20transform%3D%22rotate%28-17%20450%20350%29%22%3E%3Cpath%20d%3D%22M285%20417V296c0-231%20336-231%20336%200v121%22%20fill%3D%22none%22%20stroke%3D%22%232c3039%22%20stroke-width%3D%2262%22%2F%3E%3Cpath%20d%3D%22M285%20405V296c0-231%20336-231%20336%200v109%22%20fill%3D%22none%22%20stroke%3D%22url%28%23chrome%29%22%20stroke-width%3D%2243%22%2F%3E%3Cpath%20d%3D%22M306%20271c15-135%20269-135%20294%200%22%20fill%3D%22none%22%20stroke%3D%22%23f3e5d6%22%20stroke-width%3D%227%22%20opacity%3D%22.65%22%2F%3E%3Crect%20x%3D%22230%22%20y%3D%22335%22%20width%3D%22115%22%20height%3D%22200%22%20rx%3D%2255%22%20fill%3D%22url%28%23chrome%29%22%2F%3E%3Crect%20x%3D%22258%22%20y%3D%22344%22%20width%3D%2286%22%20height%3D%22181%22%20rx%3D%2242%22%20fill%3D%22url%28%23pad%29%22%2F%3E%3Crect%20x%3D%22559%22%20y%3D%22335%22%20width%3D%22115%22%20height%3D%22200%22%20rx%3D%2255%22%20fill%3D%22url%28%23chrome%29%22%2F%3E%3Crect%20x%3D%22558%22%20y%3D%22345%22%20width%3D%2283%22%20height%3D%22180%22%20rx%3D%2241%22%20fill%3D%22url%28%23pad%29%22%2F%3E%3Cpath%20d%3D%22M652%20374v109%22%20stroke%3D%22%23eee9d4%22%20opacity%3D%22.6%22%20stroke-width%3D%223%22%2F%3E%3Ccircle%20cx%3D%22655%22%20cy%3D%22505%22%20r%3D%225%22%20fill%3D%22%23df7a45%22%2F%3E%3C%2Fg%3E%3Cg%20fill%3D%22%23fff2db%22%20font-family%3D%22Arial%2Csans-serif%22%3E%3Ctext%20x%3D%2248%22%20y%3D%2266%22%20font-size%3D%2215%22%20letter-spacing%3D%225%22%3EARC%20%2F%20SOUND%20STUDY%3C%2Ftext%3E%3Ctext%20x%3D%2248%22%20y%3D%22650%22%20font-size%3D%2217%22%20letter-spacing%3D%222%22%3EFORM%20MEETS%20FEELING.%3C%2Ftext%3E%3Ctext%20x%3D%22804%22%20y%3D%22650%22%20font-size%3D%2217%22%3E01%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fsvg%3E")}.ww-fx-host[data-effect-type="justified-gallery"] .art[data-art="2"]{background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20900%20700%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22room%22%20x2%3D%221%22%20y2%3D%221%22%3E%3Cstop%20stop-color%3D%22%23e7ddcc%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23b8a78d%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22seat%22%20x2%3D%22.8%22%20y2%3D%221%22%3E%3Cstop%20stop-color%3D%22%23efe9d7%22%2F%3E%3Cstop%20offset%3D%22.38%22%20stop-color%3D%22%23d1c8b3%22%2F%3E%3Cstop%20offset%3D%22.75%22%20stop-color%3D%22%23a99c82%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%238b806d%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22leg%22%3E%3Cstop%20stop-color%3D%22%23a9a39b%22%2F%3E%3Cstop%20offset%3D%22.32%22%20stop-color%3D%22%23f7f4e6%22%2F%3E%3Cstop%20offset%3D%22.55%22%20stop-color%3D%22%23776f64%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23d5cbb9%22%2F%3E%3C%2FlinearGradient%3E%3Cfilter%20id%3D%22blur%22%3E%3CfeGaussianBlur%20stdDeviation%3D%2215%22%2F%3E%3C%2Ffilter%3E%3C%2Fdefs%3E%3Cpath%20fill%3D%22url%28%23room%29%22%20d%3D%22M0%200h900v700H0z%22%2F%3E%3Cpath%20d%3D%22M675%200h225v700H675z%22%20fill%3D%22%23b19e80%22%20opacity%3D%22.38%22%2F%3E%3Cpath%20d%3D%22M0%20512l675-85%20225%2083v190H0z%22%20fill%3D%22%23cfc0a4%22%2F%3E%3Cpath%20d%3D%22M65%200h144v480L65%20504z%22%20fill%3D%22%23f9f4df%22%20opacity%3D%22.45%22%2F%3E%3Cpath%20d%3D%22M250%200h40v470l-40%204z%22%20fill%3D%22%23f9f4df%22%20opacity%3D%22.3%22%2F%3E%3Cellipse%20cx%3D%22480%22%20cy%3D%22586%22%20rx%3D%22207%22%20ry%3D%2234%22%20fill%3D%22%236c5c47%22%20opacity%3D%22.32%22%20filter%3D%22url%28%23blur%29%22%2F%3E%3Cpath%20d%3D%22M350%20452l-43%20131M564%20435l50%20135M377%20429l140%20159%22%20fill%3D%22none%22%20stroke%3D%22url%28%23leg%29%22%20stroke-width%3D%2214%22%20stroke-linecap%3D%22round%22%2F%3E%3Cpath%20d%3D%22M295%20350c-27-24-40-81-18-145%2024-72%20201-97%20275-47%2058%2040%2070%20150%2065%20216-5%2063-46%2095-159%20104-118%2010-177-42-163-128z%22%20fill%3D%22url%28%23seat%29%22%2F%3E%3Cpath%20d%3D%22M302%20350c19%2038%20235%2035%20289-14%22%20fill%3D%22none%22%20stroke%3D%22%23f6efdb%22%20stroke-width%3D%224%22%20opacity%3D%22.5%22%2F%3E%3Cpath%20d%3D%22M285%20223c40-51%20185-66%20251-29%22%20fill%3D%22none%22%20stroke%3D%22%23fffae9%22%20stroke-width%3D%226%22%20opacity%3D%22.7%22%2F%3E%3Cpath%20d%3D%22M307%20372c38%2026%20178%2024%20255-7%22%20fill%3D%22none%22%20stroke%3D%22%237a705e%22%20stroke-width%3D%222%22%20opacity%3D%22.5%22%2F%3E%3Cg%20fill%3D%22%234c463b%22%20font-family%3D%22Arial%2Csans-serif%22%3E%3Ctext%20x%3D%2248%22%20y%3D%2266%22%20font-size%3D%2215%22%20letter-spacing%3D%225%22%3EOBJECT%20%2F%20COMFORT%20STUDY%3C%2Ftext%3E%3Ctext%20x%3D%2248%22%20y%3D%22650%22%20font-size%3D%2217%22%20letter-spacing%3D%222%22%3EA%20QUIETER%20KIND%20OF%20DESIGN.%3C%2Ftext%3E%3Ctext%20x%3D%22804%22%20y%3D%22650%22%20font-size%3D%2217%22%3E02%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fsvg%3E")}.ww-fx-host[data-effect-type="justified-gallery"] .art[data-art="3"]{background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20900%20700%22%3E%3Cdefs%3E%3CradialGradient%20id%3D%22space%22%3E%3Cstop%20stop-color%3D%22%233350bd%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23101526%22%2F%3E%3C%2FradialGradient%3E%3ClinearGradient%20id%3D%22ring%22%20x2%3D%22.5%22%20y2%3D%221%22%3E%3Cstop%20stop-color%3D%22%23d6e6ff%22%2F%3E%3Cstop%20offset%3D%22.22%22%20stop-color%3D%22%236575a5%22%2F%3E%3Cstop%20offset%3D%22.42%22%20stop-color%3D%22%23f3f5ff%22%2F%3E%3Cstop%20offset%3D%22.6%22%20stop-color%3D%22%23263460%22%2F%3E%3Cstop%20offset%3D%22.85%22%20stop-color%3D%22%2394b5f0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23131b3e%22%2F%3E%3C%2FlinearGradient%3E%3CradialGradient%20id%3D%22ball%22%20cx%3D%22.3%22%20cy%3D%22.2%22%3E%3Cstop%20stop-color%3D%22%23f1f4ff%22%2F%3E%3Cstop%20offset%3D%22.25%22%20stop-color%3D%22%239eb7f8%22%2F%3E%3Cstop%20offset%3D%22.63%22%20stop-color%3D%22%233f5aa0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%2317244e%22%2F%3E%3C%2FradialGradient%3E%3Cfilter%20id%3D%22glow%22%3E%3CfeGaussianBlur%20stdDeviation%3D%2217%22%2F%3E%3C%2Ffilter%3E%3C%2Fdefs%3E%3Cpath%20fill%3D%22url%28%23space%29%22%20d%3D%22M0%200h900v700H0z%22%2F%3E%3Cg%20stroke%3D%22%23b2c4ff%22%20fill%3D%22none%22%20opacity%3D%22.14%22%3E%3Cellipse%20cx%3D%22450%22%20cy%3D%22370%22%20rx%3D%22374%22%20ry%3D%22210%22%2F%3E%3Cellipse%20cx%3D%22450%22%20cy%3D%22370%22%20rx%3D%22324%22%20ry%3D%22180%22%2F%3E%3Cellipse%20cx%3D%22450%22%20cy%3D%22370%22%20rx%3D%22274%22%20ry%3D%22150%22%2F%3E%3Cpath%20d%3D%22M0%20535h900M0%20600h900M450%20150v550M0%20700l450-550%20450%20550%22%2F%3E%3C%2Fg%3E%3Cellipse%20cx%3D%22466%22%20cy%3D%22568%22%20rx%3D%22193%22%20ry%3D%2224%22%20fill%3D%22%230b1028%22%20filter%3D%22url%28%23glow%29%22%2F%3E%3Cg%20transform%3D%22rotate%28-32%20450%20350%29%22%3E%3Cellipse%20cx%3D%22450%22%20cy%3D%22350%22%20rx%3D%22238%22%20ry%3D%22140%22%20fill%3D%22none%22%20stroke%3D%22url%28%23ring%29%22%20stroke-width%3D%2258%22%2F%3E%3Ccircle%20cx%3D%22450%22%20cy%3D%22350%22%20r%3D%2291%22%20fill%3D%22url%28%23ball%29%22%2F%3E%3Cpath%20d%3D%22M216%20350c0%2078%20104%20141%20234%20141s234-63%20234-141%22%20fill%3D%22none%22%20stroke%3D%22url%28%23ring%29%22%20stroke-width%3D%2258%22%2F%3E%3Cpath%20d%3D%22M218%20363c20%2075%20140%20128%20260%20119%22%20fill%3D%22none%22%20stroke%3D%22%23e5eaff%22%20stroke-width%3D%223%22%20opacity%3D%22.6%22%2F%3E%3C%2Fg%3E%3Cg%20fill%3D%22%23d0dcff%22%20font-family%3D%22Arial%2Csans-serif%22%3E%3Ctext%20x%3D%2248%22%20y%3D%2266%22%20font-size%3D%2215%22%20letter-spacing%3D%225%22%3EORBIT%20%2F%20MOTION%20STUDY%3C%2Ftext%3E%3Ctext%20x%3D%2248%22%20y%3D%22650%22%20font-size%3D%2217%22%20letter-spacing%3D%222%22%3EA%20DIFFERENT%20PERSPECTIVE.%3C%2Ftext%3E%3Ctext%20x%3D%22804%22%20y%3D%22650%22%20font-size%3D%2217%22%3E03%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fsvg%3E")}.ww-fx-host[data-effect-type="justified-gallery"] .fx{background:#ebe7dc;color:#2a2c23}.ww-fx-host[data-effect-type="justified-gallery"] .fx small,.ww-fx-host[data-effect-type="justified-gallery"] .hint{color:#60674f}.ww-fx-host[data-effect-type="justified-gallery"] .justified{display:flex;gap:10px;align-items:stretch;min-width:0}.ww-fx-host[data-effect-type="justified-gallery"] .justified>button{flex:var(--ratio) 1 0;min-width:0;padding:0;border:0;border-radius:0;position:relative;overflow:hidden;background:transparent}.ww-fx-host[data-effect-type="justified-gallery"] .justified .art{display:block;height:300px;min-height:0;transition:transform .6s cubic-bezier(.2,.8,.2,1)}.ww-fx-host[data-effect-type="justified-gallery"] .justified>button>span:last-child{position:absolute;bottom:13px;left:10px;background:#f1ede3e6;padding:6px 8px;font-size:9px;color:#282d22}.ww-fx-host[data-effect-type="justified-gallery"] .fx[data-playing=true] .justified>button:hover .art,.ww-fx-host[data-effect-type="justified-gallery"] .fx[data-playing=true] .justified>button:focus-visible .art{transform:scale(1.07)}.ww-fx-host[data-effect-type="justified-gallery"] dialog{width:calc(100% - 28px);max-width:720px;border:0;background:#ebe7dc;color:#2a2c23;padding:18px;border-radius:4px}.ww-fx-host[data-effect-type="justified-gallery"] dialog::backdrop{background:#080c11db}.ww-fx-host[data-effect-type="justified-gallery"] dialog .art{height:min(52vh,360px);margin:15px 0;min-height:200px}.ww-fx-host[data-effect-type="justified-gallery"] dialog p{font-size:12px}.ww-fx-host[data-effect-type="justified-gallery"] dialog button{border-color:#777b68}@media(max-width:500px){.ww-fx-host[data-effect-type="justified-gallery"] .justified{gap:7px}.ww-fx-host[data-effect-type="justified-gallery"] .justified .art{height:280px}.ww-fx-host[data-effect-type="justified-gallery"] .justified>button>span:last-child{font-size:7px;left:5px;padding:5px}}
.ww-fx-host{display:block;position:relative;isolation:isolate;max-width:100%;background:#111211;color:#f4f0e7}.ww-fx-host>.ww-fx-controls{display:flex;gap:15px;align-items:center;padding:12px 20px;font:12px Arial,sans-serif}.ww-fx-host .ww-fx-controls button{color:inherit;border:1px solid #ffffff55;background:transparent;border-radius:99px;min-height:42px;padding:8px 18px;cursor:pointer}.ww-fx-host .ww-fx-image{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block}.ww-fx-host .cursor-target{display:block;color:inherit;text-decoration:none}.ww-fx-host .fx{min-height:500px}.ww-fx-host .fx .art{position:relative}.ww-fx-host .fx .portal-art,.ww-fx-host .fx .thumb-destination,.ww-fx-host .fx .scene-art{position:absolute}
{% endstylesheet %}
{% schema %}
{
"name": "WW justified-gallery",
"settings": [
{
"type": "image_picker",
"id": "image_1",
"label": "Image 1"
},
{
"type": "image_picker",
"id": "image_2",
"label": "Image 2"
},
{
"type": "image_picker",
"id": "image_3",
"label": "Image 3"
}
],
"presets": [
{
"name": "WW justified-gallery"
}
]
}
{% endschema %}
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Reference on the WESWOO case siteShopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseOpen the final thumbnail by keyboard, dismiss it and continue tabbing. If rerendering removed the thumbnail, choose a logical surviving focus target.
All four conditions opened the dialog, dismissed it and restored the magnifier’s focus. Focus restoration held across motion preferences.
Reproduce the test and inspect the readings
Open and close from the magnifier. Read whether the dialog is open, open after close and focused back on its trigger.
- 908 and 316 px, both preferences
- true then false then true
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
View the phone and desktop observations
WESWOO · 24 November 2026. We enabled reduced motion at phone width and used the default motion setting at desktop width. These observations come from the live example.
| Window / preview width | Action | Observed result |
|---|---|---|
| 390 / 316 px | Open the image and use its close control | The dialog opened with the accessible name “Enlarged website project screen”. Its close control dismissed it. |
| 1440 / 908 px | Open the image and use its close control | The dialog opened with the accessible name “Enlarged website project screen”. Its close control dismissed it. |
Preparing preview
How the effect works
Give the closer view a reason
On a backpack page, the whole image shows shape while a zipper or strap detail explains construction. Name the viewing action—for example, “Inspect the strap connection”—instead of enlarging every image indiscriminately. Keep a high-resolution image link, then enhance it with a dialog so failed scripting leaves a usable route.
Follow the current media selection
The example is a single-image detail study, not a complete product-media integration. Obtain the image, description and large-image URL from one media record and request the larger resource when needed. Rapid angle or variant changes should favour the latest selection; late responses must not overwrite it. Keep closing and a retry or image link available on failure.
Return to the original reading task
A native dialog contains the view; in this preview it acts only inside the isolated frame. On a real page, supply a clear name, visible closing and sensible focus return to the invoking thumbnail after Escape. Tall images must not push closing off a phone screen. Reduced motion can omit the entrance transition without removing viewing or exit.
Example source code
View 3 source filesHTML · CSS · MJS
<section class="fx" data-effect="zoom-dialog"><small>14 / TAKE A CLOSER LOOK</small><button type="button" class="zoom-open" aria-haspopup="dialog" aria-label="Enlarge the website project screen"><span class="art" aria-hidden="true"></span><span>Explore the detail +</span></button><dialog aria-label="Enlarged website project screen"><button type="button" data-close>Close ×</button><div class="art" role="img" aria-label="Enlarged SHOKZ website project screen"></div><p>SHOKZ website project screen, shown here to demonstrate image enlargement.</p></dialog></section>
*{box-sizing:border-box}body{margin:0;background:#111211;color:#f4f0e7;font:14px/1.55 Arial,Helvetica,sans-serif}button,input{font:inherit}button{cursor:pointer;border:1px solid #ffffff50;border-radius:99px;padding:11px 18px;color:inherit;background:transparent;min-height:42px}button:hover{background:#ffffff15}button:focus-visible,a:focus-visible,input:focus-visible,[tabindex]:focus-visible{outline:3px solid #c6fc6b;outline-offset:4px}.fx{position:relative;min-height:500px;padding:34px;overflow:hidden;display:grid;align-content:center;gap:20px;isolation:isolate;background:#111211}.fx h2,.fx h3,.fx p{margin:0}.fx h2{font-size:clamp(36px,7vw,82px);font-weight:750;letter-spacing:-.065em;line-height:.98}.fx small{letter-spacing:.18em;color:#c2c3b9;font-size:10px}.fx>small{position:relative;z-index:2;align-self:start}.fx p{max-width:46ch}.fx:after{content:'WESWOO / INTERACTION STUDY';position:absolute;bottom:12px;right:23px;font-size:8px;letter-spacing:.18em;color:inherit;opacity:.45;pointer-events:none}.art{position:relative;min-height:240px;border-radius:3px;overflow:hidden;background-color:#ea754e;background-size:cover;background-position:center}.art:before,.art:after{content:none!important}.hint{font-size:11px;color:#b5b8ad}.controls{display:flex;gap:8px;flex-wrap:wrap}.scroller{height:385px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#b7b9a6 #292a26;border-radius:3px;position:relative;outline-offset:2px;overscroll-behavior-y:contain}.spacer{height:120px;display:grid;place-items:center;color:#bfc1b5;font-size:11px;letter-spacing:.04em}.fx [hidden]{display:none!important}.fx[data-playing=false] *{animation-play-state:paused!important}.fx button[aria-pressed=true]{background:#c6fc6b;color:#171a12}.fx a{color:inherit;text-underline-offset:4px}.fx[data-reduced-motion=true] *,.fx[data-reduced-motion=true] *:before,.fx[data-reduced-motion=true] *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}
@media(max-width:500px){.fx{padding:22px;min-height:460px;gap:18px}.fx h2{font-size:43px}.fx>small{font-size:8px}.art{min-height:215px}.scroller{height:355px}.fx:after{font-size:7px;right:16px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
.zoom-open{padding:0;border:0;border-radius:12px;text-align:left;width:100%}.zoom-open>.art{display:block;min-height:220px}.zoom-open>span:last-child{display:block;padding:12px}dialog{width:calc(100% - 30px);max-width:680px;border:0;border-radius:14px;background:#16392d;color:#eef5e6;padding:20px}dialog::backdrop{background:#000b}dialog .art{margin:15px 0;min-height:230px}dialog p{font-size:12px}dialog[open] .art{animation:detail-in .35s ease-out}@keyframes detail-in{from{transform:scale(.95);opacity:.4}to{transform:none;opacity:1}}
.fx[data-effect=zoom-dialog]{background:#d6cbb7;color:#373126}.fx[data-effect=zoom-dialog] small{color:#5c5549}.fx[data-effect=zoom-dialog] .zoom-open{color:#29271e;background:transparent}.fx[data-effect=zoom-dialog] .zoom-open>.art{height:340px}.fx[data-effect=zoom-dialog] dialog{background:#eee9de;color:#2d3025;border-radius:4px}.fx[data-effect=zoom-dialog] dialog .art{min-height:290px}.fx[data-reduced-motion=true] .stack-card{position:relative;top:0!important}.fx[data-reduced-motion=true] .horizontal-story{height:370px}.fx[data-reduced-motion=true] .horizontal-pin{overflow-x:auto}.fx[data-reduced-motion=true] .horizontal-track{transform:none!important}.fx[data-reduced-motion=true] .story-grid{grid-template-columns:1fr}.fx[data-reduced-motion=true] .story-image{position:static}.fx[data-reduced-motion=true] .loop-window{overflow-x:auto}.fx[data-reduced-motion=true] .loop-set[aria-hidden=true]{display:none}
/* Real website project imagery; rights remain with the project owners. */
.art{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp");background-size:cover;background-position:center} .art[data-art="1"]{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp");background-size:cover;background-position:center} .art[data-art="2"]{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/termino-preview.webp");background-size:cover;background-position:center} .art[data-art="3"]{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp");background-size:cover;background-position:center} .art:before,.art:after{content:none!important}// WESWOO original educational example; no third-party runtime required.
export function mountEffect(root, {reducedMotion=false}={}) {
const reduced=reducedMotion||matchMedia('(prefers-reduced-motion: reduce)').matches;
root.dataset.reducedMotion=String(reduced);
const life=new AbortController(), animations=[];
let active=false, started=false;
const on=(node,type,fn,options={})=>node.addEventListener(type,fn,{...options,signal:life.signal});
const animate=(node,frames,options)=>{
if(reduced)return null;
const animation=node.animate(frames,options);animations.push(animation);return animation;
};
let start=()=>{}, stop=()=>{}, cleanup=()=>{};
const dialog=root.querySelector('dialog'),open=root.querySelector('.zoom-open');
on(open,'click',()=>{if(active&&!dialog.open)dialog.showModal();});on(root.querySelector('[data-close]'),'click',()=>dialog.close());
on(dialog,'click',event=>{if(event.target===dialog){const r=dialog.getBoundingClientRect();if(event.clientX<r.left||event.clientX>r.right||event.clientY<r.top||event.clientY>r.bottom)dialog.close();}});
stop=()=>{if(dialog.open)dialog.close();};cleanup=stop;
root.dataset.playing='false';
return {
resume(){active=true;root.dataset.playing='true';if(!started){started=true;start();}animations.forEach(a=>a.play());root.dispatchEvent(new Event('ww:resume'));},
pause(){active=false;root.dataset.playing='false';animations.forEach(a=>a.pause());stop();},
destroy(){active=false;life.abort();animations.forEach(a=>a.cancel());cleanup();}
};
}
Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- A product-media or craftsmanship Section with a real high-resolution image and the current product context.
Interaction
- A user action opens a native dialog with a contained entrance. Close, Escape and backdrop dismissal restore trigger focus. Large assets can load only after the click.
Touch and accessibility
- Reduced motion removes zoom. Limit phone dialog dimensions and allow internal scrolling. This is a single-image detail view, not pinch zoom.
Before launch
Integration files
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Reference on the WESWOO case siteShopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputFurther reading
Shopify Product Images: SEO, Variants, Alt Text, and SpeedScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseOpen two thumbnails in quick succession and dismiss. Inspect the final image and return target after the earlier image finishes loading.
Closing after the transition restored focus to the source thumbnail. Repeat that last check after changing the artwork or transition timing.
Reproduce the test and inspect the readings
Open the first thumbnail, wait for the transition, close it and check both dialog states and focus on the original link.
- 908 and 316 px, both preferences
- true then false then true
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
Preparing preview
How the effect works
Connect two views of the same image
In a case gallery, expansion from the chosen thumbnail can preserve its relationship to the directory. The transition serves inspection; retain original-image links and return to the opener after closing. It is not variant selection, and video or 3D media needs a different treatment.
Measure again when closing
The example measures thumbnail and destination geometry and connects them with translation and scale. Closing reads fresh positions to account for intervening scrolling. A theme can select images from product media with an explicit limit. Rapid clicks, early closing or Section removal must invalidate stale asynchronous work so a late image cannot reopen the view.
Example source code
View 3 source filesHTML · CSS · MJS
<section class="fx" data-effect="thumbnail-transition"><header class="ww-study-intro"><small>24 / FROM THUMBNAIL TO STORY</small><h2>OPEN A<br><em>NEW WORLD.</em></h2><p>Real website project screens. Open a screen to inspect it, then return to the same position.</p></header><ww-product-flip data-teaching-paused data-state="closed"><div class="ww-thumbs"><a href="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp" data-media-id="study-1" aria-haspopup="dialog"><img src="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp" alt="SHOKZ website project screen" width="900" height="700"><span class="ww-study-label"><span>SHOKZ</span><span>01 +</span></span></a><a href="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/termino-preview.webp" data-media-id="study-2" aria-haspopup="dialog"><img src="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/termino-preview.webp" alt="TERMINO website project screen" width="900" height="700"><span class="ww-study-label"><span>TERMINO</span><span>02 +</span></span></a><a href="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp" data-media-id="study-3" aria-haspopup="dialog"><img src="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp" alt="INIU website project screen" width="900" height="700"><span class="ww-study-label"><span>INIU</span><span>03 +</span></span></a></div><div class="ww-dots" aria-label="Gallery pagination"><button type="button" data-slide="0" aria-label="Study 1" aria-pressed="true">●</button><button type="button" data-slide="1" aria-label="Study 2" aria-pressed="false">●</button><button type="button" data-slide="2" aria-label="Study 3" aria-pressed="false">●</button></div><p data-error hidden>Image unavailable. Follow the original image link.</p><dialog aria-label="Expanded website project screen"><div class="ww-tools"><a data-original>Open original image</a><button data-close autofocus>Close ×</button></div><img data-expanded width="900" height="700" alt=""><p data-caption></p></dialog></ww-product-flip></section>ww-product-flip{display:block;color:inherit}ww-product-flip .ww-thumbs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}ww-product-flip a{color:inherit}ww-product-flip .ww-thumbs img{display:block;width:100%;height:auto}ww-product-flip dialog{border:0;padding:18px;background:#f4f0e7;color:#20241f;width:min(92vw,1000px);max-height:90dvh;overflow:auto}ww-product-flip dialog::backdrop{background:#101210dd}ww-product-flip [data-expanded]{display:block;width:auto;max-width:100%;max-height:65dvh;height:auto;object-fit:contain;transform-origin:0 0}ww-product-flip button{min-width:44px;min-height:44px}ww-product-flip :focus-visible{outline:3px solid #335c2d;outline-offset:4px}ww-product-flip .ww-tools{display:flex;gap:16px;align-items:center;justify-content:space-between}ww-product-flip[data-state="opening"] [data-caption],ww-product-flip[data-state="closing"] [data-caption]{visibility:hidden}@media(max-width:1180px){ww-product-flip .ww-thumbs{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none}ww-product-flip .ww-thumbs::-webkit-scrollbar{display:none}ww-product-flip .ww-thumbs>a{flex:0 0 85%;max-width:580px;scroll-snap-align:start}ww-product-flip [data-expanded]{height:auto}}
ww-product-flip .ww-dots{display:none}@media(max-width:1180px){ww-product-flip .ww-dots{display:flex;justify-content:center;gap:4px;flex-wrap:wrap}ww-product-flip .ww-dots button{border:0;background:none;font-size:12px;opacity:.45}ww-product-flip .ww-dots [aria-pressed="true"]{opacity:1}}
ww-product-flip .ww-thumbs{position:relative}ww-product-flip .ww-thumbs>a{text-decoration:none}ww-product-flip .ww-study-label{display:flex;justify-content:space-between;padding:14px 0;font-size:12px;letter-spacing:.12em}ww-product-flip .ww-thumbs>a:hover img{filter:brightness(1.04)}ww-product-flip [data-expanded]{margin:12px auto}
html,body{margin:0;background:#ebe6da;color:#22291f;font:14px/1.6 Arial,sans-serif}*{box-sizing:border-box}.fx{padding:28px;background:#ebe6da;color:#22291f;min-height:100vh}.ww-study-intro{display:grid;grid-template-columns:1fr 1fr;gap:12px 28px;align-items:end;margin-bottom:24px}.ww-study-intro small{grid-column:1/-1;letter-spacing:.15em;font-size:10px}.ww-study-intro h2{font:600 clamp(42px,6vw,60px)/.95 Arial;margin:0;letter-spacing:-.05em}.ww-study-intro h2 em{font-family:Georgia,serif;font-weight:400}.ww-study-intro p{max-width:36ch;font:12px/1.7 Arial;margin:0}.ww-study-label{font-family:Arial,sans-serif}button{font:inherit;cursor:pointer}a{color:inherit}@media(max-width:600px){.fx{padding:18px}.ww-study-intro{display:block;margin-bottom:20px}.ww-study-intro h2{font-size:40px;margin:12px 0}.ww-study-intro p{font-size:11px;max-width:38ch}.ww-study-label{font-size:10px!important;padding:10px 0!important}}
// WESWOO original. No third-party dependency. MIT (see LICENSE).
let instanceCount=0;
class WWProductFlip extends HTMLElement {
connectedCallback(){
if(this.life)return; this.life=new AbortController();this.motion=matchMedia('(prefers-reduced-motion: reduce)');
this.dialog=this.querySelector('dialog');this.image=this.querySelector('[data-expanded]');this.state='closed';this.generation=(this.generation||0)+1;this.active=!this.hasAttribute('data-teaching-paused');const caption=this.querySelector('[data-caption]'),strip=this.querySelector('.ww-thumbs');
if(!this.dialog||typeof this.dialog.showModal!=='function'||!this.image||!caption||!strip){this.life.abort();this.life=null;return;}
caption.id='ww-flip-caption-'+(++instanceCount);this.dialog.setAttribute('aria-labelledby',caption.id);
const on=(n,t,f)=>n.addEventListener(t,f,{signal:this.life.signal});
on(this,'click',e=>{if(!this.active){if(e.target.closest('[data-media-id],[data-slide],[data-close]'))e.preventDefault();return;}const dot=e.target.closest('[data-slide]');if(dot){const target=this.querySelectorAll('[data-media-id]')[Number(dot.dataset.slide)];if(!target)return;const strip=this.querySelector('.ww-thumbs'),left=strip.scrollLeft+target.getBoundingClientRect().left-strip.getBoundingClientRect().left;strip.scrollTo({left:Math.max(0,Math.min(strip.scrollWidth-strip.clientWidth,left)),behavior:this.reduced?'auto':'smooth'});return;}const a=e.target.closest('[data-media-id]');if(a&&this.contains(a)&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey){e.preventDefault();this.open(a);}if(e.target.closest('[data-close]'))this.close();});
on(this.dialog,'cancel',e=>{e.preventDefault();this.close();});
on(this.dialog,'close',()=>{if(!this.dialog.open)this.reset();});
on(this.image,'error',()=>{this.querySelector('[data-error]').hidden=false;this.close(true);});
on(this.dialog,'click',e=>{if(e.target===this.dialog){const r=this.dialog.getBoundingClientRect();if(e.clientX<r.left||e.clientX>r.right||e.clientY<r.top||e.clientY>r.bottom)this.close();}});
on(window,'resize',()=>{if(this.state!=='closed')this.close(true);this.syncDots();});
on(this.motion,'change',()=>{if(this.state!=='closed')this.close(true);});on(this.querySelector('.ww-thumbs'),'scroll',()=>this.syncDots());this.syncDots();
}
get reduced(){return this.forceReduced||this.motion.matches;}
setActive(value){this.active=value;if(!value)this.close(true);}
syncDots(){const left=this.querySelector('.ww-thumbs').getBoundingClientRect().left;let best=Infinity,index=0;this.querySelectorAll('[data-media-id]').forEach((item,i)=>{const d=Math.abs(item.getBoundingClientRect().left-left);if(d<best){best=d;index=i;}});this.querySelectorAll('[data-slide]').forEach((dot,i)=>dot.setAttribute('aria-pressed',String(index===i)));}
flip(from,to,reverse=false){
if(this.reduced||!this.image.animate||!from?.width||!to.width)return null;
const small={transform:`translate(${from.left-to.left}px,${from.top-to.top}px) scale(${from.width/to.width},${from.height/to.height})`};
const large={transform:'translate(0,0) scale(1,1)'};
return this.image.animate(reverse?[large,small]:[small,large],{duration:520,easing:'cubic-bezier(.2,.8,.2,1)',fill:'both'});
}
async open(a){
if(!this.active||this.state!=='closed')return;const token=++this.generation;this.origin=a;this.querySelector('[data-error]').hidden=true;this.state='opening';this.dataset.state=this.state;
const thumb=a.querySelector('img');this.image.width=thumb.naturalWidth||thumb.width||1200;this.image.height=thumb.naturalHeight||thumb.height||900;this.image.src=a.href;this.image.alt=thumb.alt;
this.querySelector('[data-original]').href=a.href;this.querySelector('[data-caption]').textContent=a.querySelector('img').alt;
try{this.dialog.showModal();}catch{this.reset();location.assign(a.href);return;}
const from=a.querySelector('img').getBoundingClientRect(),to=this.image.getBoundingClientRect();
this.anim=this.flip(from,to);const current=this.anim;
try{await current?.finished;}catch{}if(token!==this.generation||this.state!=='opening')return;
current?.cancel();this.anim=null;this.state='open';this.dataset.state=this.state;
}
async close(immediate=false){
if(this.state==='closed'||(this.state==='closing'&&!immediate))return;const token=++this.generation;
const wasOpening=this.state==='opening';this.state='closing';this.dataset.state=this.state;this.anim?.cancel();
const from=this.origin?.querySelector('img')?.getBoundingClientRect(),to=this.image.getBoundingClientRect();
// Interrupted opening closes immediately, avoiding a geometry jump.
this.anim=!immediate&&!wasOpening&&this.origin?.isConnected?this.flip(from,to,true):null;
if(immediate||wasOpening){if(this.dialog.open)this.dialog.close();this.reset();return;}const current=this.anim;try{await current?.finished;}catch{}if(token!==this.generation||this.state!=='closing')return;
this.anim?.cancel();this.anim=null;this.dialog.close();this.reset();
}
reset(){++this.generation;this.anim?.cancel();this.anim=null;this.state='closed';this.dataset.state=this.state;if(this.origin?.isConnected)this.origin.focus({preventScroll:true});}
disconnectedCallback(){++this.generation;this.life?.abort();this.life=null;this.anim?.cancel();if(this.dialog?.open)this.dialog.close();this.state='closed';}
}
if(!customElements.get('ww-product-flip'))customElements.define('ww-product-flip',WWProductFlip);
export function mountEffect(root,{reducedMotion=false}={}){const el=root.querySelector('ww-product-flip');el.connectedCallback();el.forceReduced=reducedMotion;el.setActive(false);return {resume(){el.setActive(true);root.dataset.playing='true';},pause(){el.setActive(false);root.dataset.playing='false';},destroy(){el.disconnectedCallback();}};}
Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- An independent gallery Section in a duplicate theme, reading images from
product.media. Select a product or use the current one, limited by image_limit. Keep original-image links; variants, cart, video and 3D media remain outside its scope.
Interaction
- Measure the thumbnail, open a native dialog, measure the image and animate FLIP translation and scale. Normal close reverses fresh geometry. A generation token rejects stale asynchronous completion; pause, unload and interrupted opening cancel and close immediately.
Touch and accessibility
- Reduced motion shows the final state directly. Escape and the close button return focus. No JavaScript, missing dialog support or incomplete markup retain original-image links. An image error closes with a notice, cleared on the next open.
Setup notes for this effect
Files: copy sections/ww-product-flip.liquid, assets/ww-product-flip.js and assets/ww-product-flip.css. The Section loads both assets itself and does not require the older ww-effect-studio.js.
Data: use the current or selected product’s product.media images, capped by image_limit. Video and 3D media are excluded; no images displays the editable empty message.
Integration: add the Section in a duplicate theme. Edit headings, close/original/error/pagination text and provide useful image alt text. Repeated Sections must keep independent dialogs, focus and cleanup.
Acceptance: local Liquid rendering and Theme Check passed, which does not establish merchant-theme installation. Verify images, styles, keyboard and touch in the actual theme, and separately check native product media and cart behavior.
Before launch
Integration files
ww-product-flip{display:block;color:inherit}ww-product-flip .ww-thumbs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}ww-product-flip a{color:inherit}ww-product-flip .ww-thumbs img{display:block;width:100%;height:auto}ww-product-flip dialog{border:0;padding:18px;background:#f4f0e7;color:#20241f;width:min(92vw,1000px);max-height:90dvh;overflow:auto}ww-product-flip dialog::backdrop{background:#101210dd}ww-product-flip [data-expanded]{display:block;width:auto;max-width:100%;max-height:65dvh;height:auto;object-fit:contain;transform-origin:0 0}ww-product-flip button{min-width:44px;min-height:44px}ww-product-flip :focus-visible{outline:3px solid #335c2d;outline-offset:4px}ww-product-flip .ww-tools{display:flex;gap:16px;align-items:center;justify-content:space-between}ww-product-flip[data-state="opening"] [data-caption],ww-product-flip[data-state="closing"] [data-caption]{visibility:hidden}@media(max-width:1180px){ww-product-flip .ww-thumbs{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none}ww-product-flip .ww-thumbs::-webkit-scrollbar{display:none}ww-product-flip .ww-thumbs>a{flex:0 0 85%;max-width:580px;scroll-snap-align:start}ww-product-flip [data-expanded]{height:auto}}
ww-product-flip .ww-dots{display:none}@media(max-width:1180px){ww-product-flip .ww-dots{display:flex;justify-content:center;gap:4px;flex-wrap:wrap}ww-product-flip .ww-dots button{border:0;background:none;font-size:12px;opacity:.45}ww-product-flip .ww-dots [aria-pressed="true"]{opacity:1}}
ww-product-flip .ww-thumbs{position:relative}ww-product-flip .ww-thumbs>a{text-decoration:none}ww-product-flip .ww-study-label{display:flex;justify-content:space-between;padding:14px 0;font-size:12px;letter-spacing:.12em}ww-product-flip .ww-thumbs>a:hover img{filter:brightness(1.04)}ww-product-flip [data-expanded]{margin:12px auto}// WESWOO original. No third-party dependency. MIT (see LICENSE).
let instanceCount=0;
export class WWProductFlip extends HTMLElement {
connectedCallback(){
if(this.life)return; this.life=new AbortController();this.motion=matchMedia('(prefers-reduced-motion: reduce)');
this.dialog=this.querySelector('dialog');this.image=this.querySelector('[data-expanded]');this.state='closed';this.generation=(this.generation||0)+1;this.active=!this.hasAttribute('data-teaching-paused');const caption=this.querySelector('[data-caption]'),strip=this.querySelector('.ww-thumbs');
if(!this.dialog||typeof this.dialog.showModal!=='function'||!this.image||!caption||!strip){this.life.abort();this.life=null;return;}
caption.id='ww-flip-caption-'+(++instanceCount);this.dialog.setAttribute('aria-labelledby',caption.id);
const on=(n,t,f)=>n.addEventListener(t,f,{signal:this.life.signal});
on(this,'click',e=>{if(!this.active){if(e.target.closest('[data-media-id],[data-slide],[data-close]'))e.preventDefault();return;}const dot=e.target.closest('[data-slide]');if(dot){const target=this.querySelectorAll('[data-media-id]')[Number(dot.dataset.slide)];if(!target)return;const strip=this.querySelector('.ww-thumbs'),left=strip.scrollLeft+target.getBoundingClientRect().left-strip.getBoundingClientRect().left;strip.scrollTo({left:Math.max(0,Math.min(strip.scrollWidth-strip.clientWidth,left)),behavior:this.reduced?'auto':'smooth'});return;}const a=e.target.closest('[data-media-id]');if(a&&this.contains(a)&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey){e.preventDefault();this.open(a);}if(e.target.closest('[data-close]'))this.close();});
on(this.dialog,'cancel',e=>{e.preventDefault();this.close();});
on(this.dialog,'close',()=>{if(!this.dialog.open)this.reset();});
on(this.image,'error',()=>{this.querySelector('[data-error]').hidden=false;this.close(true);});
on(this.dialog,'click',e=>{if(e.target===this.dialog){const r=this.dialog.getBoundingClientRect();if(e.clientX<r.left||e.clientX>r.right||e.clientY<r.top||e.clientY>r.bottom)this.close();}});
on(window,'resize',()=>{if(this.state!=='closed')this.close(true);this.syncDots();});
on(this.motion,'change',()=>{if(this.state!=='closed')this.close(true);});on(this.querySelector('.ww-thumbs'),'scroll',()=>this.syncDots());this.syncDots();
}
get reduced(){return this.forceReduced||this.motion.matches;}
setActive(value){this.active=value;if(!value)this.close(true);}
syncDots(){const left=this.querySelector('.ww-thumbs').getBoundingClientRect().left;let best=Infinity,index=0;this.querySelectorAll('[data-media-id]').forEach((item,i)=>{const d=Math.abs(item.getBoundingClientRect().left-left);if(d<best){best=d;index=i;}});this.querySelectorAll('[data-slide]').forEach((dot,i)=>dot.setAttribute('aria-pressed',String(index===i)));}
flip(from,to,reverse=false){
if(this.reduced||!this.image.animate||!from?.width||!to.width)return null;
const small={transform:`translate(${from.left-to.left}px,${from.top-to.top}px) scale(${from.width/to.width},${from.height/to.height})`};
const large={transform:'translate(0,0) scale(1,1)'};
return this.image.animate(reverse?[large,small]:[small,large],{duration:520,easing:'cubic-bezier(.2,.8,.2,1)',fill:'both'});
}
async open(a){
if(!this.active||this.state!=='closed')return;const token=++this.generation;this.origin=a;this.querySelector('[data-error]').hidden=true;this.state='opening';this.dataset.state=this.state;
const thumb=a.querySelector('img');this.image.width=thumb.naturalWidth||thumb.width||1200;this.image.height=thumb.naturalHeight||thumb.height||900;this.image.src=a.href;this.image.alt=thumb.alt;
this.querySelector('[data-original]').href=a.href;this.querySelector('[data-caption]').textContent=a.querySelector('img').alt;
try{this.dialog.showModal();}catch{this.reset();location.assign(a.href);return;}
const from=a.querySelector('img').getBoundingClientRect(),to=this.image.getBoundingClientRect();
this.anim=this.flip(from,to);const current=this.anim;
try{await current?.finished;}catch{}if(token!==this.generation||this.state!=='opening')return;
current?.cancel();this.anim=null;this.state='open';this.dataset.state=this.state;
}
async close(immediate=false){
if(this.state==='closed'||(this.state==='closing'&&!immediate))return;const token=++this.generation;
const wasOpening=this.state==='opening';this.state='closing';this.dataset.state=this.state;this.anim?.cancel();
const from=this.origin?.querySelector('img')?.getBoundingClientRect(),to=this.image.getBoundingClientRect();
// Interrupted opening closes immediately, avoiding a geometry jump.
this.anim=!immediate&&!wasOpening&&this.origin?.isConnected?this.flip(from,to,true):null;
if(immediate||wasOpening){if(this.dialog.open)this.dialog.close();this.reset();return;}const current=this.anim;try{await current?.finished;}catch{}if(token!==this.generation||this.state!=='closing')return;
this.anim?.cancel();this.anim=null;this.dialog.close();this.reset();
}
reset(){++this.generation;this.anim?.cancel();this.anim=null;this.state='closed';this.dataset.state=this.state;if(this.origin?.isConnected)this.origin.focus({preventScroll:true});}
disconnectedCallback(){++this.generation;this.life?.abort();this.life=null;this.anim?.cancel();if(this.dialog?.open)this.dialog.close();this.state='closed';}
}
if(!customElements.get('ww-product-flip'))customElements.define('ww-product-flip',WWProductFlip);
{{ 'ww-product-flip.css' | asset_url | stylesheet_tag }}
<script src="{{ 'ww-product-flip.js' | asset_url }}" type="module"></script>
{% assign gallery_product = section.settings.product | default: product %}
{% assign gallery_images = gallery_product.media | where: 'media_type', 'image' | slice: 0, section.settings.image_limit %}
{% if gallery_product != blank and gallery_images.size > 0 %}
<ww-product-flip id="WWFlip-{{ section.id }}" data-state="closed">
<h2 id="WWFlipTitle-{{ section.id }}">{{ section.settings.heading | escape }}</h2>
<div class="ww-thumbs" aria-labelledby="WWFlipTitle-{{ section.id }}">
{% for media in gallery_images %}
{% assign alt = media.alt | default: gallery_product.title %}
<a href="{{ media.preview_image | image_url: width: 2400 | escape }}" data-media-id="{{ media.id }}" aria-haspopup="dialog">
{{ media.preview_image | image_url: width: 960 | image_tag: alt: alt, loading: 'lazy', widths: '320, 640, 960', sizes: '(max-width: 1180px) 85vw, 45vw' }}
</a>
{% endfor %}
</div>
{% if gallery_images.size > 1 %}<div class="ww-dots" aria-label="{{ section.settings.pagination_label | escape }}">{% for media in gallery_images %}<button type="button" data-slide="{{ forloop.index0 }}" aria-label="{{ section.settings.item_label | escape }} {{ forloop.index }}" aria-pressed="{% if forloop.first %}true{% else %}false{% endif %}">●</button>{% endfor %}</div>{% endif %}
<p data-error hidden>{{ section.settings.error_text | escape }}</p>
<dialog aria-labelledby="WWFlipCaption-{{ section.id }}">
<div class="ww-tools"><a data-original>{{ section.settings.original_text | escape }}</a><button type="button" data-close autofocus>{{ section.settings.close_text | escape }}</button></div>
<img data-expanded width="1200" height="900" alt="">
<p id="WWFlipCaption-{{ section.id }}" data-caption></p>
</dialog>
</ww-product-flip>
{% elsif request.design_mode %}<p>Select a product containing image media.</p>{% endif %}
{% schema %}
{
"name": "WW product image FLIP",
"settings": [
{
"type": "product",
"id": "product",
"label": "Product (optional on PDP)"
},
{
"type": "text",
"id": "heading",
"label": "Heading",
"default": "Explore the details"
},
{
"type": "text",
"id": "close_text",
"label": "Close label",
"default": "Close"
},
{
"type": "text",
"id": "original_text",
"label": "Original image label",
"default": "Open original image"
},
{
"type": "text",
"id": "error_text",
"label": "Load error",
"default": "Image unavailable. Use the original image link."
},
{
"type": "range",
"id": "image_limit",
"label": "Maximum images in this Section",
"min": 1,
"max": 12,
"step": 1,
"default": 6
},
{
"type": "text",
"id": "pagination_label",
"label": "Pagination label",
"default": "Gallery pagination"
},
{
"type": "text",
"id": "item_label",
"label": "Image item label",
"default": "View image"
}
],
"presets": [
{
"name": "WW product image FLIP"
}
]
}
{% endschema %}
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Visual-study origin and official implementation referencesThe case supplied only the visual direction of a continuous thumbnail transition. WESWOO wrote this bidirectional product gallery; the original study illustrations are neither client cases nor a merchant installation.
Shopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseA paused carousel should still allow manual selection. The old dots left slide one visible after selecting slide three while paused. The revised controls navigate instantly in that state.
Both jumps skipped the middle slide. The status text identifies which slide the dot reached even when the pictures look alike.
Reproduce the test and inspect the readings
Go directly to the third dot and back to the first. Read both status messages.
- 908 and 316 px, both preferences
- Slide 3 of 3. No automatic advancement. then Slide 1 of 3. No automatic advancement.
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
View the phone and desktop observations
WESWOO · 24 November 2026. We enabled reduced motion at phone width and used the default motion setting at desktop width. These observations come from the live example.
| Window / preview width | Action | Observed result |
|---|---|---|
| 390 / 316 px | Select the second pagination dot | The second dot became selected. The status advanced from slide 1 of 3 to slide 2 of 3. |
| 1440 / 908 px | Select the second pagination dot | The second dot became selected. The status advanced from slide 1 of 3 to slide 2 of 3. |
Preparing preview
How the effect works
Why these cards belong together
A coffee-equipment guide might group preparation, grinding and brewing. Readers can follow the sequence or jump to the step they need. A manual slider gives the groups a shared place and visible choices. Product recommendations answer a different question—what qualifies to appear—even when their presentation also slides.
Make gestures and controls agree
The example uses native horizontal scrolling, with picker buttons moving to slide starts and scroll position updating selection. Swiping therefore updates the pickers too. Give controls useful names and retain real product links. Keep focus on the activated picker so readers can continue comparing.
Fit the cards to the reading space
The current preview remains a sliding track. A website may choose a complete card with a glimpse of the next on phones and tablets, and a grid or slider on desktop; this example does not automatically make that change. Recheck endpoints after width, image or translation changes. There is no autoplay here. Reduced motion uses direct positioning, and failed enhancement should leave a readable list.
Example source code
View 3 source filesHTML · CSS · MJS
<section class="fx" data-effect="content-slider"><small>15 / CHOOSE YOUR PACE</small><div class="slides" tabindex="0" aria-label="Swipe the three website project screens"><div class="slide"><div class="art" data-art="1"></div><strong>01 / SHOKZ</strong></div><div class="slide"><div class="art" data-art="2"></div><strong>02 / TERMINO</strong></div><div class="slide"><div class="art" data-art="3"></div><strong>03 / INIU</strong></div></div><div class="slide-dots" role="group" aria-label="Choose a slide"><button type="button" data-slide="0" aria-pressed="true" aria-label="Slide 1">1</button><button type="button" data-slide="1" aria-pressed="false" aria-label="Slide 2">2</button><button type="button" data-slide="2" aria-pressed="false" aria-label="Slide 3">3</button></div><p class="hint" role="status">Slide 1 of 3. No automatic advancement.</p></section>
*{box-sizing:border-box}body{margin:0;background:#111211;color:#f4f0e7;font:14px/1.55 Arial,Helvetica,sans-serif}button,input{font:inherit}button{cursor:pointer;border:1px solid #ffffff50;border-radius:99px;padding:11px 18px;color:inherit;background:transparent;min-height:42px}button:hover{background:#ffffff15}button:focus-visible,a:focus-visible,input:focus-visible,[tabindex]:focus-visible{outline:3px solid #c6fc6b;outline-offset:4px}.fx{position:relative;min-height:500px;padding:34px;overflow:hidden;display:grid;align-content:center;gap:20px;isolation:isolate;background:#111211}.fx h2,.fx h3,.fx p{margin:0}.fx h2{font-size:clamp(36px,7vw,82px);font-weight:750;letter-spacing:-.065em;line-height:.98}.fx small{letter-spacing:.18em;color:#c2c3b9;font-size:10px}.fx>small{position:relative;z-index:2;align-self:start}.fx p{max-width:46ch}.fx:after{content:'WESWOO / INTERACTION STUDY';position:absolute;bottom:12px;right:23px;font-size:8px;letter-spacing:.18em;color:inherit;opacity:.45;pointer-events:none}.art{position:relative;min-height:240px;border-radius:3px;overflow:hidden;background-color:#ea754e;background-size:cover;background-position:center}.art:before,.art:after{content:none!important}.hint{font-size:11px;color:#b5b8ad}.controls{display:flex;gap:8px;flex-wrap:wrap}.scroller{height:385px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#b7b9a6 #292a26;border-radius:3px;position:relative;outline-offset:2px;overscroll-behavior-y:contain}.spacer{height:120px;display:grid;place-items:center;color:#bfc1b5;font-size:11px;letter-spacing:.04em}.fx [hidden]{display:none!important}.fx[data-playing=false] *{animation-play-state:paused!important}.fx button[aria-pressed=true]{background:#c6fc6b;color:#171a12}.fx a{color:inherit;text-underline-offset:4px}.fx[data-reduced-motion=true] *,.fx[data-reduced-motion=true] *:before,.fx[data-reduced-motion=true] *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}
@media(max-width:500px){.fx{padding:22px;min-height:460px;gap:18px}.fx h2{font-size:43px}.fx>small{font-size:8px}.art{min-height:215px}.scroller{height:355px}.fx:after{font-size:7px;right:16px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
.slides{display:flex;gap:14px;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none}.slides::-webkit-scrollbar{display:none}.slide{flex:0 0 88%;scroll-snap-align:start}.slide .art{min-height:210px}.slide strong{display:block;margin-top:10px}.slide-dots{display:flex;gap:10px;justify-content:center}.slide-dots button{width:36px;height:36px;padding:0;border-radius:50%;font-size:12px}
.fx[data-effect=content-slider] .slide .art{height:330px}.fx[data-effect=content-slider] .slide strong{font:italic 18px Georgia,serif}.fx[data-reduced-motion=true] .stack-card{position:relative;top:0!important}.fx[data-reduced-motion=true] .horizontal-story{height:370px}.fx[data-reduced-motion=true] .horizontal-pin{overflow-x:auto}.fx[data-reduced-motion=true] .horizontal-track{transform:none!important}.fx[data-reduced-motion=true] .story-grid{grid-template-columns:1fr}.fx[data-reduced-motion=true] .story-image{position:static}.fx[data-reduced-motion=true] .loop-window{overflow-x:auto}.fx[data-reduced-motion=true] .loop-set[aria-hidden=true]{display:none}
@media(max-width:600px){.fx[data-effect=content-slider] .slide .art{height:300px}}
/* Real website project imagery; rights remain with the project owners. */
.art{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp");background-size:cover;background-position:center} .art[data-art="1"]{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp");background-size:cover;background-position:center} .art[data-art="2"]{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/termino-preview.webp");background-size:cover;background-position:center} .art[data-art="3"]{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp");background-size:cover;background-position:center} .art:before,.art:after{content:none!important}// WESWOO original educational example; no third-party runtime required.
export function mountEffect(root, {reducedMotion=false}={}) {
const reduced=reducedMotion||matchMedia('(prefers-reduced-motion: reduce)').matches;
root.dataset.reducedMotion=String(reduced);
const life=new AbortController(), animations=[];
let active=false, started=false;
const on=(node,type,fn,options={})=>node.addEventListener(type,fn,{...options,signal:life.signal});
const animate=(node,frames,options)=>{
if(reduced)return null;
const animation=node.animate(frames,options);animations.push(animation);return animation;
};
let start=()=>{}, stop=()=>{}, cleanup=()=>{};
const viewport=root.querySelector('.slides'),slides=[...root.querySelectorAll('.slide')],dots=[...root.querySelectorAll('[data-slide]')];
dots.forEach((button,i)=>on(button,'click',()=>{viewport.scrollTo({left:slides[i].offsetLeft-slides[0].offsetLeft,behavior:reduced||!active?'instant':'smooth'});}));
let frame=0;function reflect(){frame=0;let index=0,distance=Infinity;slides.forEach((slide,i)=>{const delta=Math.abs(slide.offsetLeft-slides[0].offsetLeft-viewport.scrollLeft);if(delta<distance){distance=delta;index=i;}});dots.forEach((button,i)=>button.setAttribute('aria-pressed',String(i===index)));root.querySelector('[role=status]').textContent=`Slide ${index+1} of ${slides.length}. No automatic advancement.`;}
on(viewport,'scroll',()=>{if(!frame)frame=requestAnimationFrame(reflect);},{passive:true});cleanup=()=>cancelAnimationFrame(frame);
root.dataset.playing='false';
return {
resume(){active=true;root.dataset.playing='true';if(!started){started=true;start();}animations.forEach(a=>a.play());root.dispatchEvent(new Event('ww:resume'));},
pause(){active=false;root.dataset.playing='false';animations.forEach(a=>a.pause());stop();},
destroy(){active=false;life.abort();animations.forEach(a=>a.cancel());cleanup();}
};
}
Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- A homepage, collection introduction or case Section. Prefer the existing theme slider instead of adding another library.
Interaction
- CSS scroll-snap provides native scrolling. Dots align slide starts with scrollTo; scroll updates find the nearest slide and reflect pressed state and status text.
Touch and accessibility
- No automatic advancement. Reduced motion positions instantly. Keep a focusable scroll region and usable dots. This local example should be adapted to the existing component.
Before launch
Integration files
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Reference on the WESWOO case siteShopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseTab through destinations across the loop seam. Check for duplicate focus stops from visual copies and give each real product a stable destination.
The wide and narrow previews used one loop each. With reduced motion the count stayed at zero and the image strip remained in the document.
Reproduce the test and inspect the readings
Start, pause and resume the looping strip and count active animations.
- 908 and 316 px, default motion
- 1 then 0 then 1
- 908 and 316 px, reduced motion
- 0 then 0 then 0
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
Preparing preview
How the effect works
Make browsing different from searching
An inspiration page can let materials or settings pass by to establish an impression. Requiring shoppers to chase one image to open a product obstructs selection. Keep work names, product links and essential descriptions in a stable list, with the loop supplying atmosphere.
Match two sets at the seam
The example duplicates one image set and moves half the total width. Dimensions and gaps must match, and real assets need appropriate rights. Keep focusable controls out of the duplicate set so keyboard users do not enter a moving copy. Pausing permits inspection; reduced motion can retain a single still gallery.
Example source code
View 3 source filesHTML · CSS · MJS
<section class="fx" data-effect="loop-gallery"><small>16 / A DECORATIVE LOOP</small><h2>KEEP EXPLORING.</h2><div class="loop-window" aria-label="Website project screen strip"><div class="loop-track"><div class="loop-set"><div class="art" data-art="1"></div><div class="art" data-art="2"></div><div class="art" data-art="3"></div></div><div class="loop-set" aria-hidden="true"><div class="art" data-art="1"></div><div class="art" data-art="2"></div><div class="art" data-art="3"></div></div></div></div><p class="hint">A decorative loop. Put real links in a separate, stable list.</p></section>
*{box-sizing:border-box}body{margin:0;background:#111211;color:#f4f0e7;font:14px/1.55 Arial,Helvetica,sans-serif}button,input{font:inherit}button{cursor:pointer;border:1px solid #ffffff50;border-radius:99px;padding:11px 18px;color:inherit;background:transparent;min-height:42px}button:hover{background:#ffffff15}button:focus-visible,a:focus-visible,input:focus-visible,[tabindex]:focus-visible{outline:3px solid #c6fc6b;outline-offset:4px}.fx{position:relative;min-height:500px;padding:34px;overflow:hidden;display:grid;align-content:center;gap:20px;isolation:isolate;background:#111211}.fx h2,.fx h3,.fx p{margin:0}.fx h2{font-size:clamp(36px,7vw,82px);font-weight:750;letter-spacing:-.065em;line-height:.98}.fx small{letter-spacing:.18em;color:#c2c3b9;font-size:10px}.fx>small{position:relative;z-index:2;align-self:start}.fx p{max-width:46ch}.fx:after{content:'WESWOO / INTERACTION STUDY';position:absolute;bottom:12px;right:23px;font-size:8px;letter-spacing:.18em;color:inherit;opacity:.45;pointer-events:none}.art{position:relative;min-height:240px;border-radius:3px;overflow:hidden;background-color:#ea754e;background-size:cover;background-position:center}.art:before,.art:after{content:none!important}.hint{font-size:11px;color:#b5b8ad}.controls{display:flex;gap:8px;flex-wrap:wrap}.scroller{height:385px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#b7b9a6 #292a26;border-radius:3px;position:relative;outline-offset:2px;overscroll-behavior-y:contain}.spacer{height:120px;display:grid;place-items:center;color:#bfc1b5;font-size:11px;letter-spacing:.04em}.fx [hidden]{display:none!important}.fx[data-playing=false] *{animation-play-state:paused!important}.fx button[aria-pressed=true]{background:#c6fc6b;color:#171a12}.fx a{color:inherit;text-underline-offset:4px}.fx[data-reduced-motion=true] *,.fx[data-reduced-motion=true] *:before,.fx[data-reduced-motion=true] *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}
@media(max-width:500px){.fx{padding:22px;min-height:460px;gap:18px}.fx h2{font-size:43px}.fx>small{font-size:8px}.art{min-height:215px}.scroller{height:355px}.fx:after{font-size:7px;right:16px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
.loop-window{overflow:hidden;margin:0 -30px}.loop-track{display:flex;width:max-content}.loop-set{display:flex;gap:16px;padding-right:16px;flex:none}.loop-set .art{width:200px;min-height:180px}.loop-set .art:before{left:10%}@media(prefers-reduced-motion:reduce){.loop-window{overflow-x:auto}.loop-set[aria-hidden=true]{display:none}}
.fx[data-effect=loop-gallery]{background:#ddd6c7;color:#282b23}.fx[data-effect=loop-gallery] small,.fx[data-effect=loop-gallery] .hint{color:#626550}.fx[data-effect=loop-gallery] h2{font-size:clamp(36px,6vw,64px)}.fx[data-effect=loop-gallery] .loop-set .art{width:265px;min-height:255px}.fx[data-reduced-motion=true] .stack-card{position:relative;top:0!important}.fx[data-reduced-motion=true] .horizontal-story{height:370px}.fx[data-reduced-motion=true] .horizontal-pin{overflow-x:auto}.fx[data-reduced-motion=true] .horizontal-track{transform:none!important}.fx[data-reduced-motion=true] .story-grid{grid-template-columns:1fr}.fx[data-reduced-motion=true] .story-image{position:static}.fx[data-reduced-motion=true] .loop-window{overflow-x:auto}.fx[data-reduced-motion=true] .loop-set[aria-hidden=true]{display:none}
@media(max-width:600px){.fx[data-effect=loop-gallery] .loop-set .art{width:210px;min-height:230px}}
/* Real website project imagery; rights remain with the project owners. */
.art{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp");background-size:cover;background-position:center} .art[data-art="1"]{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp");background-size:cover;background-position:center} .art[data-art="2"]{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/termino-preview.webp");background-size:cover;background-position:center} .art[data-art="3"]{background-image:url("https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp");background-size:cover;background-position:center} .art:before,.art:after{content:none!important}// WESWOO original educational example; no third-party runtime required.
export function mountEffect(root, {reducedMotion=false}={}) {
const reduced=reducedMotion||matchMedia('(prefers-reduced-motion: reduce)').matches;
root.dataset.reducedMotion=String(reduced);
const life=new AbortController(), animations=[];
let active=false, started=false;
const on=(node,type,fn,options={})=>node.addEventListener(type,fn,{...options,signal:life.signal});
const animate=(node,frames,options)=>{
if(reduced)return null;
const animation=node.animate(frames,options);animations.push(animation);return animation;
};
let start=()=>{}, stop=()=>{}, cleanup=()=>{};
start=()=>animate(root.querySelector('.loop-track'),[{transform:'translateX(0)'},{transform:'translateX(-50%)'}],{duration:22000,iterations:Infinity,easing:'linear'});
root.dataset.playing='false';
return {
resume(){active=true;root.dataset.playing='true';if(!started){started=true;start();}animations.forEach(a=>a.play());root.dispatchEvent(new Event('ww:resume'));},
pause(){active=false;root.dataset.playing='false';animations.forEach(a=>a.pause());stop();},
destroy(){active=false;life.abort();animations.forEach(a=>a.cancel());cleanup();}
};
}
Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- A brand-mood or inspiration Section using authorized, lightweight assets. Put important project links in a still list.
Interaction
- Two equal-width image sets move by half the total track width. Hide the duplicate set from assistive technology and put no focusable controls inside it. Pause when hidden.
Touch and accessibility
- Reduced motion hides the duplicate set and permits direct browsing of the original. Avoid essential product decisions or legal information here.
Before launch
Integration files
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Reference on the WESWOO case siteShopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseMove the divider to both ends and view both images without fine dragging. State differences in shooting conditions before drawing any conclusion about products.
The divider drove the clip to 100% and 0%. When a slider moves but its picture does not, inspect this value to locate the broken connection.
Reproduce the test and inspect the readings
Move the first divider from its midpoint to maximum and minimum. Read the percentage used for clipping.
- 908 and 316 px, both preferences
- 50% then 100% then 0%
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
View the phone and desktop observations
WESWOO · 24 November 2026. We enabled reduced motion at phone width and used the default motion setting at desktop width. These observations come from the live example.
| Window / preview width | Action | Observed result |
|---|---|---|
| 390 / 316 px | Focus the first divider and press End | The divider started at 50. End moved it to its maximum of 100. |
| 1440 / 908 px | Focus the first divider and press End | The divider started at 50. End moved it to its maximum of 100. |
Preparing preview
How the effect works
How to use
Compare composition across different project page screenshots.
Example source code
View 3 source filesHTML · CSS · MJS
<section class='fx gallery' lang='en'><div class='rail'><article class='card'><div class='cmp' data-cmp><img src='https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp' alt='SHOKZ page screenshot'><div class='top'><img src='https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/termino-preview.webp' alt='TERMINO page screenshot'></div><b>TERMINO</b><strong>SHOKZ</strong></div><label>Move divider<input type='range' min='0' max='100' value='50'></label></article><article class='card'><div class='cmp' data-cmp><img src='https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp' alt='INIU page screenshot'><div class='top'><img src='https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/fms-preview.webp' alt='FMS page screenshot'></div><b>FMS</b><strong>INIU</strong></div><label>Move divider<input type='range' min='0' max='100' value='50'></label></article><article class='card'><div class='cmp' data-cmp><img src='https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/termino-preview.webp' alt='TERMINO page screenshot'><div class='top'><img src='https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp' alt='INIU page screenshot'></div><b>INIU</b><strong>TERMINO</strong></div><label>Move divider<input type='range' min='0' max='100' value='50'></label></article></div><nav class='dots'><button data-dot type='button' aria-label='Screen 1' aria-pressed='true'></button><button data-dot type='button' aria-label='Screen 2' aria-pressed='false'></button><button data-dot type='button' aria-label='Screen 3' aria-pressed='false'></button></nav></section>.gallery.fx{max-width:1100px;margin:auto;padding:24px;background:#f2f0e8;color:#22372e;font:16px/1.6 system-ui,sans-serif}.gallery *{box-sizing:border-box}.rail{display:grid;grid-auto-flow:column;grid-auto-columns:calc(100% - 40px);gap:14px;overflow:auto;scroll-snap-type:x mandatory;scrollbar-width:none;overscroll-behavior-x:contain}.rail::-webkit-scrollbar{display:none}.card{min-width:0;scroll-snap-align:start}.card img{display:block;width:100%;height:100%;object-fit:cover;object-position:top}.dots{display:flex;justify-content:center;gap:12px;margin:14px}.dots button{width:16px;height:16px;border:2px solid #315241;border-radius:50%;background:transparent}.dots [aria-pressed=true]{background:#315241}.gallery :focus-visible{outline:3px solid #a45d13}@media(min-width:760px){.rail{grid-auto-flow:initial;grid-template-columns:repeat(3,minmax(0,1fr));overflow:visible}.dots{display:none}}@media(prefers-reduced-motion:reduce){.gallery *{scroll-behavior:auto!important;animation:none!important;transition:none!important}}.cmp{position:relative;aspect-ratio:16/10;overflow:hidden;--cut:50%}.cmp>img{height:100%}.cmp .top{position:absolute;inset:0 auto 0 0;width:var(--cut);overflow:hidden;border-right:2px solid white}.cmp .top img{max-width:none}.cmp b,.cmp strong{position:absolute;top:5px;background:#173629;color:white;padding:4px}.cmp b{left:5px}.cmp strong{right:5px}.card input{width:100%;min-height:44px;touch-action:pan-y}
.g-credit{font-size:12px;letter-spacing:.04em;color:#526157}.g-source{position:absolute;left:8px;bottom:8px;padding:3px 8px;border-radius:12px;background:#183628dd;color:#fff;font-size:11px;z-index:2}
.card input[type=range]{appearance:none;-webkit-appearance:none;background:transparent;cursor:ew-resize}.card input[type=range]::-webkit-slider-runnable-track{height:8px;border-radius:8px;background:linear-gradient(90deg,#24543e,#9aac9e)}.card input[type=range]::-moz-range-track{height:8px;border-radius:8px;background:linear-gradient(90deg,#24543e,#9aac9e)}.card input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:24px;height:24px;margin-top:-8px;border:3px solid #f2f0e8;border-radius:50%;background:#24543e;box-shadow:0 0 0 2px #24543e}.card input[type=range]::-moz-range-thumb{width:18px;height:18px;border:3px solid #f2f0e8;border-radius:50%;background:#24543e;box-shadow:0 0 0 2px #24543e}
export function mountEffect(root,{reducedMotion=false}={}){const ctl=new AbortController(),signal=ctl.signal,rail=root.querySelector('.rail'),cards=[...root.querySelectorAll('.card')],dots=[...root.querySelectorAll('[data-dot]')];let paused=false,dead=false;const noMotion=()=>reducedMotion||matchMedia('(prefers-reduced-motion: reduce)').matches||paused;function go(i){if(dead||!cards[i])return;rail.scrollTo({left:cards[i].offsetLeft-cards[0].offsetLeft,behavior:noMotion()?'instant':'smooth'});dots.forEach((d,n)=>d.setAttribute('aria-pressed',String(n===i)));}dots.forEach((d,i)=>d.addEventListener('click',()=>go(i),{signal}));rail.addEventListener('scroll',()=>{const x=rail.scrollLeft+cards[0].offsetLeft,i=cards.reduce((b,c,n)=>Math.abs(c.offsetLeft-x)<Math.abs(cards[b].offsetLeft-x)?n:b,0);dots.forEach((d,n)=>d.setAttribute('aria-pressed',String(i===n)));},{passive:true,signal});root.querySelectorAll('.cmp').forEach(x=>{const r=x.parentElement.querySelector('input'),t=x.querySelector('.top');function u(){x.style.setProperty('--cut',r.value+'%');t.firstElementChild.style.width=x.clientWidth+'px'}r.addEventListener('input',u,{signal});new ResizeObserver(u).observe(x);u()});return{resume(){if(!dead){paused=false;root.dataset.paused='false';}},pause(){paused=true;root.dataset.paused='true';rail.scrollTo({left:rail.scrollLeft,behavior:'instant'});},destroy(){dead=true;ctl.abort();delete root.dataset.paused;}}}Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- For webpage review; screenshots do not establish product or client outcome data.
Interaction
- Native range clips the upper screenshot.
Touch and accessibility
- Screenshots and text remain available without scripting; vertical scrolling is unaffected.
Setup notes for this effect
Replace sample images with imagery you may use, then test the interaction in the theme editor and on phones.
Before launch
Integration files
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Codrops interaction referenceCodrops ScrollBasedLayoutAnimations is an interaction-direction reference only; this divider is independently written with a native range, without copied repository code or runtime dependencies.
Shopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseReframe the image and verify that each hotspot still points to its intended part. Select it via text as well. Working percentage coordinates can still identify the wrong detail after cropping.
Image hotspots and text controls updated the same note. The text control restored the opening note without requiring a precise tap on the picture.
Reproduce the test and inspect the readings
Read the first image note, select its third hotspot, then its first text control. Record each visible note.
- 908 and 316 px, both preferences
- Review the page opening. then Look for a next step. then Review the page opening.
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
View the phone and desktop observations
WESWOO · 24 November 2026. We enabled reduced motion at phone width and used the default motion setting at desktop width. These observations come from the live example.
| Window / preview width | Action | Observed result |
|---|---|---|
| 390 / 316 px | 2 | The selected or expanded control read “2 / Visual focus / 1 / Opening / 1”. |
| 1440 / 908 px | 2 | The selected or expanded control read “2 / Visual focus / 1 / Opening / 1”. |
Preparing preview
How the effect works
How to use
Switch page-review prompts; no product parts are annotated.
Example source code
View 3 source filesHTML · CSS · MJS
<section class='fx gallery' lang='en'><div class='rail'><article class='card'><div class='shot'><img src="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp" alt="SHOKZ WESWOO project page screenshot" loading="lazy"><span class="g-source">SHOKZ · WESWOO project page screenshot</span><button type="button" data-p='0' aria-pressed='true' style='--x:70%;--y:20%'>1</button><button type="button" data-p='1' aria-pressed='false' style='--x:50%;--y:50%'>2</button><button type="button" data-p='2' aria-pressed='false' style='--x:75%;--y:80%'>3</button></div><div class='hot-controls'><button type="button" data-s='0' aria-pressed='true'>Opening</button><button type="button" data-s='1' aria-pressed='false'>Visual focus</button><button type="button" data-s='2' aria-pressed='false'>Next step</button></div><p data-n='0' >Review the page opening.</p><p data-n='1' hidden>Notice image and text.</p><p data-n='2' hidden>Look for a next step.</p></article><article class='card'><div class='shot'><img src="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp" alt="INIU WESWOO project page screenshot" loading="lazy"><span class="g-source">INIU · WESWOO project page screenshot</span><button type="button" data-p='0' aria-pressed='true' style='--x:70%;--y:20%'>1</button><button type="button" data-p='1' aria-pressed='false' style='--x:50%;--y:50%'>2</button><button type="button" data-p='2' aria-pressed='false' style='--x:75%;--y:80%'>3</button></div><div class='hot-controls'><button type="button" data-s='0' aria-pressed='true'>Opening</button><button type="button" data-s='1' aria-pressed='false'>Visual focus</button><button type="button" data-s='2' aria-pressed='false'>Next step</button></div><p data-n='0' >Review the page opening.</p><p data-n='1' hidden>Notice image and text.</p><p data-n='2' hidden>Look for a next step.</p></article><article class='card'><div class='shot'><img src="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/fms-preview.webp" alt="FMS WESWOO project page screenshot" loading="lazy"><span class="g-source">FMS · WESWOO project page</span><button type="button" data-p='0' aria-pressed='true' style='--x:70%;--y:20%'>1</button><button type="button" data-p='1' aria-pressed='false' style='--x:50%;--y:50%'>2</button><button type="button" data-p='2' aria-pressed='false' style='--x:75%;--y:80%'>3</button></div><div class='hot-controls'><button type="button" data-s='0' aria-pressed='true'>Opening</button><button type="button" data-s='1' aria-pressed='false'>Visual focus</button><button type="button" data-s='2' aria-pressed='false'>Next step</button></div><p data-n='0' >Review the page opening.</p><p data-n='1' hidden>Notice image and text.</p><p data-n='2' hidden>Look for a next step.</p></article></div><nav class='dots'><button data-dot type='button' aria-label='Screen 1' aria-pressed='true'></button><button data-dot type='button' aria-label='Screen 2' aria-pressed='false'></button><button data-dot type='button' aria-label='Screen 3' aria-pressed='false'></button></nav></section>.gallery.fx{max-width:1100px;margin:auto;padding:24px;background:#f2f0e8;color:#22372e;font:16px/1.6 system-ui,sans-serif}.gallery *{box-sizing:border-box}.rail{display:grid;grid-auto-flow:column;grid-auto-columns:calc(100% - 40px);gap:14px;overflow:auto;scroll-snap-type:x mandatory;scrollbar-width:none;overscroll-behavior-x:contain}.rail::-webkit-scrollbar{display:none}.card{min-width:0;scroll-snap-align:start}.card img{display:block;width:100%;height:100%;object-fit:cover;object-position:top}.dots{display:flex;justify-content:center;gap:12px;margin:14px}.dots button{width:16px;height:16px;border:2px solid #315241;border-radius:50%;background:transparent}.dots [aria-pressed=true]{background:#315241}.gallery :focus-visible{outline:3px solid #a45d13}@media(min-width:760px){.rail{grid-auto-flow:initial;grid-template-columns:repeat(3,minmax(0,1fr));overflow:visible}.dots{display:none}}@media(prefers-reduced-motion:reduce){.gallery *{scroll-behavior:auto!important;animation:none!important;transition:none!important}}.shot{position:relative;aspect-ratio:16/10;overflow:hidden}.shot button[data-p]{position:absolute;left:var(--x);top:var(--y);width:44px;height:44px;border-radius:50%;background:#24543e;color:white}.card [data-s]{min-height:44px;margin:4px}.card p{min-height:2em}
.g-credit{font-size:12px;letter-spacing:.04em;color:#526157}.g-source{position:absolute;left:8px;bottom:8px;padding:3px 8px;border-radius:12px;background:#183628dd;color:#fff;font-size:11px;z-index:2}
.shot{background:#f4f4ef}.shot button[data-p]{border:2px solid #fff;background:#24543e;color:#fff;font:700 17px/1 system-ui;box-shadow:0 2px 10px #14261d80;cursor:pointer}.shot button[data-p][aria-pressed=true]{background:#a65019;transform:translate(-50%,-50%) scale(1.08)}.hot-controls{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}.hot-controls button{flex:1 1 auto;min-width:0;min-height:46px;padding:8px 12px;border:1px solid #476453;border-radius:24px;background:#fff;color:#20372b;font:600 14px/1.35 system-ui;cursor:pointer}.hot-controls button[aria-pressed=true]{background:#24543e;color:white}.hot-controls button:focus-visible,.shot button:focus-visible{outline:3px solid #a45d13;outline-offset:3px}.hot-notes{padding:10px 12px;border-left:3px solid #a65019;background:#fff;border-radius:0 8px 8px 0}
export function mountEffect(root,{reducedMotion=false}={}){const ctl=new AbortController(),signal=ctl.signal,rail=root.querySelector('.rail'),cards=[...root.querySelectorAll('.card')],dots=[...root.querySelectorAll('[data-dot]')];let paused=false,dead=false;const noMotion=()=>reducedMotion||matchMedia('(prefers-reduced-motion: reduce)').matches||paused;function go(i){if(dead||!cards[i])return;rail.scrollTo({left:cards[i].offsetLeft-cards[0].offsetLeft,behavior:noMotion()?'instant':'smooth'});dots.forEach((d,n)=>d.setAttribute('aria-pressed',String(n===i)));}dots.forEach((d,i)=>d.addEventListener('click',()=>go(i),{signal}));rail.addEventListener('scroll',()=>{const x=rail.scrollLeft+cards[0].offsetLeft,i=cards.reduce((b,c,n)=>Math.abs(c.offsetLeft-x)<Math.abs(cards[b].offsetLeft-x)?n:b,0);dots.forEach((d,n)=>d.setAttribute('aria-pressed',String(i===n)));},{passive:true,signal});root.querySelectorAll('.card').forEach(c=>{const p=[...c.querySelectorAll('[data-p]')],s2=[...c.querySelectorAll('[data-s]')],n=[...c.querySelectorAll('[data-n]')];function f(i){p.forEach((x,k)=>x.setAttribute('aria-pressed',String(k===i)));s2.forEach((x,k)=>x.setAttribute('aria-pressed',String(k===i)));n.forEach((x,k)=>x.hidden=k!==i)}p.forEach((x,i)=>x.addEventListener('click',()=>f(i),{signal}));s2.forEach((x,i)=>x.addEventListener('click',()=>f(i),{signal}))});root.dataset.enhanced='true';return{resume(){if(!dead){paused=false;delete root.dataset.paused;}},pause(){paused=true;root.dataset.paused='true';rail.scrollTo({left:rail.scrollLeft,behavior:'instant'});},destroy(){dead=true;ctl.abort();delete root.dataset.paused;delete root.dataset.enhanced;}}}Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- For webpage review; screenshots do not establish product or client outcome data.
Interaction
- Screenshot pins and text prompts stay in sync.
Touch and accessibility
- Screenshots and text remain available without scripting; vertical scrolling is unaffected.
Setup notes for this effect
Replace sample images with imagery you may use, then test the interaction in the theme editor and on phones.
Before launch
Integration files
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Interaction and accessibility referenceHotspots are page-review prompts, not claims about links, product construction or outcomes.
Shopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseWhy does the full mobile banner now have gray bands above and below it?
Contain changed the picture fit but left the tall frame. With Dawn 15.4.1’s Image banner template and styles, a 1200 × 500 image at 390 px occupied a 340 px Medium frame. Contain recovered both edges but left 178 gray rows. Adapting the height to the first image gave a roughly 163 px frame, both edges and zero gray rows.
In a duplicate theme, open the affected Image banner and change Banner height from Medium to Adapt to first image. Check the saved preview. If the tall mobile banner must remain, prepare a portrait composition. Recheck with real headings, buttons, a second image or stacking enabled.
Compare results, scope and replay code
390 px / Medium: 340 px high, both edge landmarks cropped.
Same frame with contain: both edges, 178 gray rows in total. Adapt: 163 px tall, zero gray rows.
The merchant’s follow-up explicitly reports bands after recovering the full image. We rendered a pinned Dawn template with its two original stylesheets and sampled screenshot pixels, substituting a calibration image for Shopify image filters. The historical merchant theme and private CSS were not inspected.
WESWOO tested Chrome 157.0.8103.79. In a clean directory with Node.js 22 or newer, run npm install playwright liquidjs@10.21.1, then npx playwright install chromium, then node weswoo-dawn-frame.cjs. The script fetches three pinned files from Shopify’s repository and checks their SHA-256. Add --screens to save all three screenshots.
Original question · Shopify Dawn 15.4.1 · Image banner · Shopify Dawn 15.4.1 · Image banner CSS · MDN · object-fit
How do I hide just the homepage slideshow on phones and keep the product gallery?
Scope the mobile media query to the homepage section’s wrapper ID. Inspect the ID generated by your theme and replace the sample home-hero ID. Test both sides of the breakpoint and a separate gallery link.
Two sections shared one page. We checked the hero and gallery at four widths, then intentionally applied a broad selector.
Compare results, scope and replay code
At 390 and 749 pixels only the hero was hidden. At 750 and 1280 both were visible. A broad section rule also hid the second gallery.
This merchant explicitly wanted to hide the slideshow. For a visible, uncropped image, use the framing comparison on this page. Hiding a section does not establish any download savings.
@media (max-width: 749px) {
#shopify-section-home-hero { display: none; }
} Tested in Chrome 157.0.8103.79. In a clean directory with Node.js 22 or later run, in order, npm install playwright → npx playwright install chromium → node weswoo-slideshow-width.cjs.
Open the loaded asset separately before comparing the three frames. The shared source is a website screenshot. This study addresses framing, not physical product fit in a room.
Narrowing the preview from 908 to 316 px changed three fully visible FMS frames to one. Changing only the motion preference left that count unchanged.
Reproduce the test and inspect the readings
Count cards fully inside the rail and report fully visible / total.
- 908 px, both preferences
- 3 / 3
- 316 px, both preferences
- 1 / 3
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
View the phone and desktop observations
WESWOO · 24 November 2026. We enabled reduced motion at phone width and used the default motion setting at desktop width. These observations come from the live example.
| Window / preview width | Action | Observed result |
|---|---|---|
| 390 / 316 px | Open the framing comparison | The same FMS screenshot has detail, mid-frame and full-image views. Fully visible cards at this width: 1 of 3. |
| 1440 / 908 px | Open the framing comparison | The same FMS screenshot has detail, mid-frame and full-image views. Fully visible cards at this width: 3 of 3. |
See the WESWOO test and results
Compare the edges of the first two frames with the full screenshot in the third. At phone width, select the last dot for the full frame, then return with the first dot.
| Framing or viewport | Observed result |
|---|---|
| Detail / mid-frame | Same file, cover, scaled 1.50× / 1.15× |
| Full frame | Same file, contain, no added scale |
| 1440 px window / 908 px preview | Three frames fit without horizontal travel |
| 390 px window / 316 px preview | Selecting the last dot moved the rail 438 px from its start |
Pixel values belong to this page layout. The asset is a project-page screenshot. The test compares framing and says nothing about physical product size or performance.
Preparing preview
How the effect works
Observed result
All three views use one FMS project screenshot. They sit side by side on desktop. On the phone, the last dot brings the full frame into view. The third view changes image fitting while keeping the same file URL.
How to use
Narrow, medium and wide frames show an FMS screenshot crop, not real breakpoint behavior.
Example source code
View 3 source filesHTML · CSS · MJS
<section class='fx gallery' lang='en'><div class='rail'><article class='card'><div class='view crop0'><img src='https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/fms-preview.webp' alt='FMS WESWOO project page screenshot' loading='lazy'></div><h3>Detail crop · FMS</h3></article><article class='card'><div class='view crop1'><img src='https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/fms-preview.webp' alt='FMS WESWOO project page screenshot' loading='lazy'></div><h3>Mid-frame · FMS</h3></article><article class='card'><div class='view crop2'><img src='https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/fms-preview.webp' alt='FMS WESWOO project page screenshot' loading='lazy'></div><h3>Full image · FMS</h3></article></div><nav class='dots'><button data-dot type='button' aria-label='Screen 1' aria-pressed='true'></button><button data-dot type='button' aria-label='Screen 2' aria-pressed='false'></button><button data-dot type='button' aria-label='Screen 3' aria-pressed='false'></button></nav></section>.gallery.fx{max-width:1100px;margin:auto;padding:24px;background:#f2f0e8;color:#22372e;font:16px/1.6 system-ui,sans-serif}.rail{display:grid;grid-auto-flow:column;grid-auto-columns:calc(100% - 42px);gap:14px;overflow:auto;scroll-snap-type:x mandatory;scrollbar-width:none}.rail::-webkit-scrollbar{display:none}.card{min-width:0;scroll-snap-align:start}.view{height:280px;overflow:hidden;border-radius:12px;background:#fff}.view img{display:block;width:100%;height:100%;object-fit:cover}.view.crop0 img{object-position:50% 10%;transform:scale(1.5);transform-origin:50% 10%}.view.crop1 img{object-position:50% 50%;transform:scale(1.15);transform-origin:50% 50%}.view.crop2{height:auto;aspect-ratio:16/10}.view.crop2 img{object-fit:contain}.card h3{font-size:16px}.dots{display:flex;justify-content:center;gap:12px;margin:14px}.dots button{width:16px;height:16px;border:2px solid #315241;border-radius:50%;background:transparent}.dots [aria-pressed=true]{background:#315241}@media(min-width:760px){.rail{grid-auto-flow:initial;grid-template-columns:repeat(3,minmax(0,1fr));overflow:visible}.dots{display:none}}@media(prefers-reduced-motion:reduce){.gallery *{scroll-behavior:auto!important;animation:none!important;transition:none!important}}
export function mountEffect(root,{reducedMotion=false}={}){const ctl=new AbortController(),signal=ctl.signal,rail=root.querySelector('.rail'),cards=[...root.querySelectorAll('.card')],dots=[...root.querySelectorAll('[data-dot]')];let paused=false,dead=false;const noMotion=()=>reducedMotion||matchMedia('(prefers-reduced-motion: reduce)').matches||paused;function go(i){if(dead||!cards[i])return;rail.scrollTo({left:cards[i].offsetLeft-cards[0].offsetLeft,behavior:noMotion()?'instant':'smooth'});dots.forEach((d,n)=>d.setAttribute('aria-pressed',String(n===i)));}dots.forEach((d,i)=>d.addEventListener('click',()=>go(i),{signal}));rail.addEventListener('scroll',()=>{const x=rail.scrollLeft+cards[0].offsetLeft,i=cards.reduce((b,c,n)=>Math.abs(c.offsetLeft-x)<Math.abs(cards[b].offsetLeft-x)?n:b,0);dots.forEach((d,n)=>d.setAttribute('aria-pressed',String(i===n)));},{passive:true,signal});return{resume(){if(!dead){paused=false;root.dataset.paused='false';}},pause(){paused=true;root.dataset.paused='true';rail.scrollTo({left:rail.scrollLeft,behavior:'instant'});},destroy(){dead=true;ctl.abort();delete root.dataset.paused;}}}Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- For browsing and discussing webpage imagery; all views crop the same real screenshot.
Interaction
- Three cards show the upper detail, middle area and full screenshot; swipe to select on phones.
Touch and accessibility
- All three views remain visible without scripting; the full screenshot retains its original ratio.
Setup notes for this effect
Replace sample images with imagery you may use, then test the interaction in the theme editor and on phones.
Before launch
Integration files
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Interaction and accessibility referenceStatic viewport crops do not replace live responsive testing.
Shopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseHold project fixed while changing region, then hold region fixed across projects. For product specifications, use versioned, sourced measurements with units instead of screenshot areas.
The lower area remained selectable after changing projects. The “Viewing lower area” message confirms that the second action ran.
Reproduce the test and inspect the readings
Select the second project on the first card and then Bottom. Read the resulting area feedback.
- 908 and 316 px, both preferences
- Viewing lower area
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
View the phone and desktop observations
WESWOO · 24 November 2026. We enabled reduced motion at phone width and used the default motion setting at desktop width. These observations come from the live example.
| Window / preview width | Action | Observed result |
|---|---|---|
| 390 / 316 px | TERMINO | The selected or expanded control read “TERMINO / Top / INIU / Top / TERMINO”. |
| 1440 / 908 px | TERMINO | The selected or expanded control read “TERMINO / Top / INIU / Top / TERMINO”. |
Preparing preview
How the effect works
How to use
Review headings, visuals and actions; no fictional product specs.
Example source code
View 3 source filesHTML · CSS · MJS
<section class='fx gallery' lang='en'><div class='rail'><article class='card'><figure class='review-shot'><img data-image src='https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp' alt='SHOKZ WESWOO project page screenshot' loading='lazy'><figcaption data-brand>SHOKZ website page</figcaption></figure><div class='project-switch'><button type='button' data-project='0' aria-pressed='true'>SHOKZ</button><button type='button' data-project='1' aria-pressed='false'>TERMINO</button></div><div class='area-switch'><button type='button' data-area='0' aria-pressed='true'>Top</button><button type='button' data-area='1' aria-pressed='false'>Middle</button><button type='button' data-area='2' aria-pressed='false'>Bottom</button></div><p data-review aria-live='polite'></p></article><article class='card'><figure class='review-shot'><img data-image src='https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp' alt='INIU WESWOO project page screenshot' loading='lazy'><figcaption data-brand>INIU website page</figcaption></figure><div class='project-switch'><button type='button' data-project='2' aria-pressed='true'>INIU</button><button type='button' data-project='3' aria-pressed='false'>FMS</button></div><div class='area-switch'><button type='button' data-area='0' aria-pressed='true'>Top</button><button type='button' data-area='1' aria-pressed='false'>Middle</button><button type='button' data-area='2' aria-pressed='false'>Bottom</button></div><p data-review aria-live='polite'></p></article><article class='card'><figure class='review-shot'><img data-image src='https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/termino-preview.webp' alt='TERMINO WESWOO project page screenshot' loading='lazy'><figcaption data-brand>TERMINO website page</figcaption></figure><div class='project-switch'><button type='button' data-project='1' aria-pressed='true'>TERMINO</button><button type='button' data-project='2' aria-pressed='false'>INIU</button></div><div class='area-switch'><button type='button' data-area='0' aria-pressed='true'>Top</button><button type='button' data-area='1' aria-pressed='false'>Middle</button><button type='button' data-area='2' aria-pressed='false'>Bottom</button></div><p data-review aria-live='polite'></p></article></div><nav class='dots'><button data-dot type='button' aria-label='Screen 1' aria-pressed='true'></button><button data-dot type='button' aria-label='Screen 2' aria-pressed='false'></button><button data-dot type='button' aria-label='Screen 3' aria-pressed='false'></button></nav></section>.gallery.fx{max-width:1100px;margin:auto;padding:24px;background:#f2f0e8;color:#22372e;font:16px/1.6 system-ui,sans-serif}.rail{display:grid;grid-auto-flow:column;grid-auto-columns:calc(100% - 42px);gap:14px;overflow:auto;scroll-snap-type:x mandatory;scrollbar-width:none;overscroll-behavior-x:contain}.rail::-webkit-scrollbar{display:none}.card{min-width:0;scroll-snap-align:start}.review-shot{position:relative;aspect-ratio:16/10;overflow:hidden;border-radius:12px;background:#fff;margin:0}.review-shot img{width:100%;height:100%;object-fit:cover;object-position:top}.review-shot figcaption{position:absolute;left:8px;top:8px;padding:5px 10px;border-radius:18px;background:#163629e8;color:white;font-weight:700}.project-switch,.area-switch{display:flex;gap:7px;flex-wrap:wrap;margin:10px 0}.project-switch button,.area-switch button{flex:1 1 auto;min-width:0;min-height:44px;padding:7px 10px;border:1px solid #476453;border-radius:22px;background:#fff;color:#20372b;font:600 14px system-ui;cursor:pointer}.project-switch [aria-pressed=true],.area-switch [aria-pressed=true]{background:#24543e;color:white}.card p{min-height:2.5em;padding:10px 12px;background:white;border-left:3px solid #a65019}.dots{display:flex;justify-content:center;gap:12px;margin:14px}.dots button{width:16px;height:16px;border:2px solid #315241;border-radius:50%;background:transparent}.dots [aria-pressed=true]{background:#315241}.gallery :focus-visible{outline:3px solid #a45d13;outline-offset:3px}@media(min-width:760px){.rail{grid-auto-flow:initial;grid-template-columns:repeat(3,minmax(0,1fr));overflow:visible}.dots{display:none}}@media(prefers-reduced-motion:reduce){.gallery *{scroll-behavior:auto!important;animation:none!important;transition:none!important}}
export function mountEffect(root,{reducedMotion=false}={}){const ctl=new AbortController(),signal=ctl.signal,rail=root.querySelector('.rail'),cards=[...root.querySelectorAll('.card')],dots=[...root.querySelectorAll('[data-dot]')];let paused=false,dead=false;function go(i){if(dead||!cards[i])return;rail.scrollTo({left:cards[i].offsetLeft-cards[0].offsetLeft,behavior:reducedMotion||paused?'instant':'smooth'});dots.forEach((d,n)=>d.setAttribute('aria-pressed',String(n===i)))}dots.forEach((d,i)=>d.addEventListener('click',()=>go(i),{signal}));rail.addEventListener('scroll',()=>{const x=rail.scrollLeft+cards[0].offsetLeft,i=cards.reduce((b,c,n)=>Math.abs(c.offsetLeft-x)<Math.abs(cards[b].offsetLeft-x)?n:b,0);dots.forEach((d,n)=>d.setAttribute('aria-pressed',String(n===i)))},{passive:true,signal});const urls=["https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp", "https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/termino-preview.webp", "https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp", "https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/fms-preview.webp"];root.querySelectorAll('.card').forEach(card=>{const img=card.querySelector('[data-image]'),brand=card.querySelector('[data-brand]'),projects=[...card.querySelectorAll('[data-project]')],areas=[...card.querySelectorAll('[data-area]')],note=card.querySelector('[data-review]');projects.forEach(btn=>btn.addEventListener('click',()=>{const i=Number(btn.dataset.project);img.src=urls[i];img.alt=btn.textContent+(root.lang==='zh-CN'?' 网站页面截图':' WESWOO project page screenshot');brand.textContent=btn.textContent+(root.lang==='zh-CN'?' 网站页面':' website page');note.textContent=(root.lang==='zh-CN'?'当前项目:':'Current project: ')+btn.textContent;projects.forEach(x=>x.setAttribute('aria-pressed',String(x===btn)))},{signal}));areas.forEach((btn,i)=>btn.addEventListener('click',()=>{areas.forEach(x=>x.setAttribute('aria-pressed',String(x===btn)));note.textContent=(root.lang==='zh-CN'?['查看上部画面','查看中部画面','查看下部画面']:['Viewing upper area','Viewing middle area','Viewing lower area'])[i];img.style.objectPosition=['top','center','bottom'][i]},{signal}))});root.dataset.enhanced='true';return{resume(){if(!dead){paused=false;delete root.dataset.paused}},pause(){paused=true;root.dataset.paused='true';rail.scrollTo({left:rail.scrollLeft,behavior:'instant'})},destroy(){dead=true;ctl.abort();delete root.dataset.paused;delete root.dataset.enhanced}}}Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- For visual review and page-content discussion; contains no fictional product specs, scores or client results.
Interaction
- Each large screenshot switches between two projects; area controls change the screenshot view. Phones show one card with a preview and pagination dots.
Touch and accessibility
- Project screenshots, names and page-review prompts remain available without scripting.
Setup notes for this effect
Replace sample images with imagery you may use, then test the interaction in the theme editor and on phones.
Before launch
Integration files
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Interaction and accessibility referenceReframed the former spec comparison as a page-content checklist.
Shopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseIdentify the screenshot region represented by each layer. Actual assembly guidance requires approved parts diagrams and instructions; these layers illustrate reading order.
The layers went from assembled to expanded and back. Reduced motion retained the same operation.
Reproduce the test and inspect the readings
Toggle the first image’s layers twice and read its expanded state.
- 908 and 316 px, both preferences
- false then true then false
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
View the phone and desktop observations
WESWOO · 24 November 2026. We enabled reduced motion at phone width and used the default motion setting at desktop width. These observations come from the live example.
| Window / preview width | Action | Observed result |
|---|---|---|
| 390 / 316 px | Separate image layers | After switching the first SHOKZ image, its button changed to Reassemble image layers. |
| 1440 / 908 px | Separate image layers | After switching the first SHOKZ image, its button changed to Reassemble image layers. |
Preparing preview
How the effect works
How to use
Explore expandable reading layers beside screenshots; not a DOM reconstruction.
Example source code
View 3 source filesHTML · CSS · MJS
<section class='fx gallery' lang='en'><div class='rail'><article class='card'><div class='slices' role='img' aria-label='SHOKZ WESWOO project page screenshot'><span class='slice top' style='--pic:url(https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp)'></span><span class='slice mid' style='--pic:url(https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp)'></span><span class='slice bottom' style='--pic:url(https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp)'></span></div><p class='brand'>SHOKZ · WESWOO project page screenshot</p><button type='button' data-expand aria-expanded='false'>Separate image layers</button></article><article class='card'><div class='slices' role='img' aria-label='FMS WESWOO project page screenshot'><span class='slice top' style='--pic:url(https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/fms-preview.webp)'></span><span class='slice mid' style='--pic:url(https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/fms-preview.webp)'></span><span class='slice bottom' style='--pic:url(https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/fms-preview.webp)'></span></div><p class='brand'>FMS · WESWOO project page screenshot</p><button type='button' data-expand aria-expanded='false'>Separate image layers</button></article><article class='card'><div class='slices' role='img' aria-label='INIU WESWOO project page screenshot'><span class='slice top' style='--pic:url(https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp)'></span><span class='slice mid' style='--pic:url(https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp)'></span><span class='slice bottom' style='--pic:url(https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp)'></span></div><p class='brand'>INIU · WESWOO project page screenshot</p><button type='button' data-expand aria-expanded='false'>Separate image layers</button></article></div><nav class='dots'><button data-dot aria-label='1' aria-pressed='true'></button><button data-dot aria-label='2' aria-pressed='false'></button><button data-dot aria-label='3' aria-pressed='false'></button></nav></section>.gallery.fx{max-width:1100px;margin:auto;padding:24px;background:#f2f0e8;color:#22372e;font:16px/1.6 system-ui,sans-serif}.rail{display:grid;grid-auto-flow:column;grid-auto-columns:calc(100% - 42px);gap:14px;overflow:auto;scroll-snap-type:x mandatory;scrollbar-width:none}.rail::-webkit-scrollbar{display:none}.card{min-width:0;scroll-snap-align:start}.slices{display:grid;grid-template-rows:repeat(3,1fr);gap:0;aspect-ratio:2/1;overflow:visible;border-radius:12px}.slice{display:block;background-image:var(--pic);background-repeat:no-repeat;background-size:100% 300%;background-color:#fff;min-height:0}.slice.top{background-position:top}.slice.mid{background-position:center}.slice.bottom{background-position:bottom}.slices.is-open{gap:9px}.slices.is-open .top{transform:translateY(-3px)}.slices.is-open .bottom{transform:translateY(3px)}.brand{font-weight:700}.card button[data-expand]{min-height:46px;padding:8px 16px;border:1px solid #41594a;border-radius:24px;background:#24543e;color:white;font:600 15px system-ui;cursor:pointer}.card .note{font-size:13px;color:#526157}.dots{display:flex;justify-content:center;gap:12px;margin:14px}.dots button{width:16px;height:16px;border:2px solid #315241;border-radius:50%;background:transparent}.dots [aria-pressed=true]{background:#315241}.gallery :focus-visible{outline:3px solid #a45d13;outline-offset:3px}@media(min-width:760px){.rail{grid-auto-flow:initial;grid-template-columns:repeat(3,minmax(0,1fr));overflow:visible}.dots{display:none}}@media(prefers-reduced-motion:reduce){.slices,.slice{transition:none!important}}
.gallery[data-paused=true] .slices{transition:none!important}.slices,.slice{transition:gap .24s ease}.slices.is-open{gap:8px}
.gallery[data-reduced-motion=true] .slices,.gallery[data-reduced-motion=true] .slice{transition:none!important}/* Adapted layout transition concept from Codrops ScrollBasedLayoutAnimations.
Repository: https://github.com/codrops/ScrollBasedLayoutAnimations
MIT License
Copyright (c) 2009 - 2022 Codrops (https://tympanus.net/codrops)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
export function mountEffect(root,{reducedMotion=false}={}){const c=new AbortController(),s=c.signal,r=root.querySelector('.rail'),cards=[...root.querySelectorAll('.card')],dots=[...root.querySelectorAll('[data-dot]')];let paused=false,dead=false,animations=[];function go(i){if(dead||!cards[i])return;r.scrollTo({left:cards[i].offsetLeft-cards[0].offsetLeft,behavior:reducedMotion||paused?'instant':'smooth'});dots.forEach((d,n)=>d.setAttribute('aria-pressed',String(n===i)))}dots.forEach((d,i)=>d.addEventListener('click',()=>go(i),{signal:s}));r.addEventListener('scroll',()=>{const x=r.scrollLeft+cards[0].offsetLeft,i=cards.reduce((b,a,n)=>Math.abs(a.offsetLeft-x)<Math.abs(cards[b].offsetLeft-x)?n:b,0);dots.forEach((d,n)=>d.setAttribute('aria-pressed',String(n===i)))},{passive:true,signal:s});root.querySelectorAll('[data-expand]').forEach(b=>b.addEventListener('click',()=>{animations.forEach(a=>a.cancel());animations=[];const box=b.parentElement.querySelector('.slices'),parts=[...box.querySelectorAll('.slice')],before=parts.map(x=>x.getBoundingClientRect()),open=!box.classList.contains('is-open');box.classList.toggle('is-open',open);b.setAttribute('aria-expanded',String(open));b.textContent=open?(root.lang==='zh-CN'?'合拢画面层次':'Reassemble image layers'):(root.lang==='zh-CN'?'展开画面层次':'Separate image layers');if(!reducedMotion&&!paused)parts.forEach((x,i)=>{const after=x.getBoundingClientRect(),dx=before[i].left-after.left,dy=before[i].top-after.top;if(dx||dy)animations.push(x.animate([{transform:'translate('+dx+'px,'+dy+'px)'},{transform:'translate(0,0)'}],{duration:240,easing:'cubic-bezier(.2,.7,.2,1)'}))})},{signal:s}));root.dataset.enhanced='true';if(reducedMotion)root.dataset.reducedMotion='true';return{resume(){if(!dead){paused=false;delete root.dataset.paused}},pause(){paused=true;root.dataset.paused='true';animations.forEach(a=>a.cancel());animations=[]},destroy(){dead=true;c.abort();animations.forEach(a=>a.cancel());animations=[];root.querySelectorAll('.slices').forEach(x=>x.classList.remove('is-open'));root.querySelectorAll('[data-expand]').forEach(b=>{b.setAttribute('aria-expanded','false');b.textContent=root.lang==='zh-CN'?'展开画面层次':'Separate image layers'});delete root.dataset.reducedMotion;delete root.dataset.paused;delete root.dataset.enhanced}}}Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- Shows layers of the screenshot image itself, not source-page DOM or navigation structure.
Interaction
- Three slices use the original screenshot’s top, middle and bottom thirds and reassemble into the full page image.
Touch and accessibility
- Without scripting the strips stay adjacent and the full screenshot remains recognizable.
Setup notes for this effect
Replace sample images with imagery you may use, then test the interaction in the theme editor and on phones.
Before launch
Integration files
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Codrops interaction referenceApplies the layout-switch/FLIP concept from Codrops ScrollBasedLayoutAnimations. The three screenshot strips map to the source image’s top, middle and bottom pixels. No GSAP is used; the script includes the full MIT notice.
Shopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseTap a caption on mobile and select a different card by keyboard. Verify caption and destination follow the final card and remain accessible without hover or animation.
The default caption opened and closed. With reduced motion it started expanded and stayed readable after both selections.
Reproduce the test and inspect the readings
Select the first photo twice and read its caption’s expanded state.
- 908 and 316 px, default motion
- false then true then false
- 908 and 316 px, reduced motion
- true then true then true
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
Preparing preview
How the effect works
Start with the reader’s task
Start with a photograph, then reveal a concise caption by hovering or tapping.
Keep imagery and interaction clear
Provide meaningful alternatives and source attribution. Replace the sample with material you may use, then test mobile input, motion preferences and page scrolling.
Example source code
View 3 source filesHTML · CSS · MJS
<section class="fx lookbook-demo" data-effect="lookbook-reveal"><header class="lb-header"><p class="lb-eyebrow">WESWOO / Visual showcase</p><h2>Real photography.<br>A story worth exploring.</h2><p class="lb-intro">Explore materials, settings and visual storytelling through three portrait photographs. Hover or tap to reveal the description; tap again or press Escape to close. This is a visual interaction demo.</p></header><section class="lb-grid" aria-label="Portrait photography"><button type="button" class="lb-card" aria-expanded="false" aria-controls="lb-detail-1"><img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22480%22%20height%3D%22640%22%20viewBox%3D%220%200%20480%20640%22%3E%3Crect%20width%3D%22480%22%20height%3D%22640%22%20fill%3D%22%23e8ece6%22%2F%3E%3Ctext%20x%3D%22240%22%20y%3D%22300%22%20text-anchor%3D%22middle%22%20font-family%3D%22sans-serif%22%20font-size%3D%2221%22%20fill%3D%22%2340564b%22%3EReplace%20image%201%3C%2Ftext%3E%3Ctext%20x%3D%22240%22%20y%3D%22338%22%20text-anchor%3D%22middle%22%20font-family%3D%22sans-serif%22%20font-size%3D%2215%22%20fill%3D%22%2340564b%22%3EUse%20your%20own%20licensed%20photograph%3C%2Ftext%3E%3C%2Fsvg%3E" alt="A portrait in warm light"><span class="lb-photo-label">01 / Portrait</span><span class="lb-caption" id="lb-detail-1"><span class="lb-index">PORTRAIT 01</span><strong>A portrait in warm light</strong><p>Warm light and posture shape the composition.</p><span class="lb-action">Tap to close · Interaction demo</span></span></button><button type="button" class="lb-card" aria-expanded="false" aria-controls="lb-detail-2"><img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22480%22%20height%3D%22640%22%20viewBox%3D%220%200%20480%20640%22%3E%3Crect%20width%3D%22480%22%20height%3D%22640%22%20fill%3D%22%23e8ece6%22%2F%3E%3Ctext%20x%3D%22240%22%20y%3D%22300%22%20text-anchor%3D%22middle%22%20font-family%3D%22sans-serif%22%20font-size%3D%2221%22%20fill%3D%22%2340564b%22%3EReplace%20image%202%3C%2Ftext%3E%3Ctext%20x%3D%22240%22%20y%3D%22338%22%20text-anchor%3D%22middle%22%20font-family%3D%22sans-serif%22%20font-size%3D%2215%22%20fill%3D%22%2340564b%22%3EUse%20your%20own%20licensed%20photograph%3C%2Ftext%3E%3C%2Fsvg%3E" alt="A street fashion portrait against blue architecture"><span class="lb-photo-label">02 / Street style</span><span class="lb-caption" id="lb-detail-2"><span class="lb-index">STREET 02</span><strong>Street style in blue</strong><p>A portrait and blue architecture create a strong colour contrast.</p><span class="lb-action">Tap to close · Interaction demo</span></span></button><button type="button" class="lb-card" aria-expanded="false" aria-controls="lb-detail-3"><img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22480%22%20height%3D%22640%22%20viewBox%3D%220%200%20480%20640%22%3E%3Crect%20width%3D%22480%22%20height%3D%22640%22%20fill%3D%22%23e8ece6%22%2F%3E%3Ctext%20x%3D%22240%22%20y%3D%22300%22%20text-anchor%3D%22middle%22%20font-family%3D%22sans-serif%22%20font-size%3D%2221%22%20fill%3D%22%2340564b%22%3EReplace%20image%203%3C%2Ftext%3E%3Ctext%20x%3D%22240%22%20y%3D%22338%22%20text-anchor%3D%22middle%22%20font-family%3D%22sans-serif%22%20font-size%3D%2215%22%20fill%3D%22%2340564b%22%3EUse%20your%20own%20licensed%20photograph%3C%2Ftext%3E%3C%2Fsvg%3E" alt="A studio portrait against a dark background"><span class="lb-photo-label">03 / Studio portrait</span><span class="lb-caption" id="lb-detail-3"><span class="lb-index">STUDIO 03</span><strong>A quiet studio portrait</strong><p>A dark backdrop keeps the focus on the portrait.</p><span class="lb-action">Tap to close · Interaction demo</span></span></button></section><div class="lb-dots" aria-label="Gallery pages"><button type="button" data-lb-dot aria-label="1" aria-pressed="true"></button><button type="button" data-lb-dot aria-label="2" aria-pressed="false"></button><button type="button" data-lb-dot aria-label="3" aria-pressed="false"></button></div></section>.lookbook-demo{--ink:#182b27;--paper:#f1eee7;--accent:#b7c7ad;font-family:Arial,"Microsoft YaHei",sans-serif;color:var(--ink);background:var(--paper);padding:clamp(20px,4vw,60px);max-width:1440px;margin:auto;box-sizing:border-box}.lookbook-demo *{box-sizing:border-box}.lb-header{max-width:760px;margin-bottom:32px}.lb-eyebrow{font-size:12px;letter-spacing:.18em;text-transform:uppercase}.lb-header h2{font-size:clamp(30px,4.3vw,62px);font-weight:500;line-height:1.12;margin:16px 0}.lb-intro{font-size:15px;line-height:1.8;max-width:560px}.lb-controls{display:flex;gap:10px;flex-wrap:wrap;margin:20px 0}.lb-controls button{background:transparent;border:1px solid #6d7a71;border-radius:24px;padding:10px 17px;color:inherit;font:inherit;cursor:pointer}.lb-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px}.lb-card{position:relative;aspect-ratio:3/4;overflow:hidden;border:0;padding:0;background:#d9ddd3;text-align:left;font:inherit;color:inherit;cursor:pointer;isolation:isolate}.lb-card>img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .7s ease}.lb-photo-label{position:absolute;left:20px;top:20px;z-index:1;background:rgba(241,238,231,.92);padding:7px 10px;font-size:12px}.lb-caption{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:flex-end;padding:clamp(20px,3vw,38px);background:var(--accent);clip-path:polygon(0 100%,17% 100%,29% 100%,43% 100%,58% 100%,73% 100%,87% 100%,100% 100%,100% 100%,0 100%);transition:clip-path .65s cubic-bezier(.2,.75,.2,1);z-index:2}.lb-card:nth-child(2){--accent:#dbc8ad}.lb-card:nth-child(3){--accent:#c4d0d5}.lb-card.is-open .lb-caption{clip-path:polygon(0 0,17% 4%,29% 1%,43% 5%,58% 0,73% 4%,87% 1%,100% 3%,100% 100%,0 100%)}.lb-card.is-open>img{transform:scale(1.045)}.lb-index{font-size:12px;letter-spacing:.1em;margin-bottom:auto;padding-top:12px}.lb-caption strong{font-size:clamp(25px,2.4vw,36px);font-weight:500;line-height:1.15}.lb-caption p{font-size:14px;line-height:1.7;margin:16px 0 24px}.lb-action{border-top:1px solid currentColor;padding-top:14px;font-size:12px}.lb-card:focus-visible,.lb-controls button:focus-visible{outline:3px solid #196f9c;outline-offset:4px}.lb-footnote{font-size:12px;line-height:1.7;margin-top:22px;max-width:760px}.lookbook-demo[data-paused=true] *{transition:none!important;animation-play-state:paused!important}@media(max-width:800px){.lb-grid{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;padding:4px 4px 12px;gap:14px}.lb-grid::-webkit-scrollbar{display:none}.lb-card{flex:0 0 84%;scroll-snap-align:start}.lb-header h2{font-size:36px}}@media(prefers-reduced-motion:reduce){.lookbook-demo *{transition:none!important;scroll-behavior:auto!important}}
.lookbook-demo[data-reduced-motion=true] *{transition:none!important;scroll-behavior:auto!important}.lb-dots{display:none;justify-content:center;gap:12px;margin:16px 0}.lb-dots button{width:12px;height:12px;border:1px solid var(--ink);border-radius:50%;padding:0;background:transparent;cursor:pointer}.lb-dots button[aria-pressed=true]{background:var(--ink)}.lb-dots button:focus-visible{outline:3px solid #196f9c;outline-offset:4px}@media(max-width:800px){.lb-dots{display:flex}.lb-grid{position:relative}}
.lb-card[data-entry=left] .lb-caption{clip-path:inset(0 100% 0 0)}.lb-card[data-entry=right] .lb-caption{clip-path:inset(0 0 0 100%)}.lb-card[data-entry=top] .lb-caption{clip-path:inset(0 0 100% 0)}.lb-card[data-entry=bottom] .lb-caption{clip-path:inset(100% 0 0 0)}.lb-card.is-open .lb-caption{clip-path:inset(0)}
.lookbook-demo[data-reduced-motion=true] .lb-card .lb-caption{clip-path:inset(0)!important}
.lb-card{aspect-ratio:3/4;min-height:360px}.lb-caption{padding:20px}.lb-caption strong{font-size:clamp(22px,2.4vw,30px)}.lb-caption p{font-size:13px;line-height:1.5;margin:12px 0 16px}@media(max-width:800px){.lb-card{min-height:390px;aspect-ratio:3/4}.lb-caption{padding:20px}.lb-caption strong{font-size:26px}}
/* Adapted from Codrops LookbookHoverEffects js/wipe.js (MIT).
MIT License
Copyright (c) 2009 - 2026 [Codrops](https://codrops.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
function wwEntrySide(look,e){
const r=look.getBoundingClientRect();
const x=Math.min(1,Math.max(0,(e.clientX-r.left)/r.width));
const y=Math.min(1,Math.max(0,(e.clientY-r.top)/r.height));
const gaps={left:x,right:1-x,top:y,bottom:1-y};
return Object.keys(gaps).reduce((a,b)=>gaps[b]<gaps[a]?b:a);
}
export function mountEffect(root, {reducedMotion=false}={}) {
const controller=new AbortController();
const surface=root.matches('.lookbook-demo')?root:root.querySelector('.lookbook-demo');
if(!surface)return{resume(){},pause(){},destroy(){controller.abort();}};
const cards=Array.from(surface.querySelectorAll('.lb-card'));
let paused=false,pinned=null;
surface.dataset.reducedMotion=String(reducedMotion);
function on(node,type,fn){node.addEventListener(type,fn,{signal:controller.signal});}
function reveal(card){cards.forEach(item=>{const open=reducedMotion||item===card;item.classList.toggle('is-open',open);item.setAttribute('aria-expanded',String(open));});}
reveal(null);
cards.forEach(card=>{
on(card,'pointerenter',e=>{if(e.pointerType==='mouse'&&!paused){card.dataset.entry=wwEntrySide(card,e);reveal(card);}});
on(card,'pointerleave',e=>{if(e.pointerType==='mouse'&&!paused)reveal(pinned);});
on(card,'click',()=>{pinned=pinned===card?null:card;reveal(pinned);});
on(card,'keydown',e=>{if(e.key==='Escape'){pinned=null;reveal(null);}});
on(card,'blur',()=>{if(pinned===card)pinned=null;reveal(null);});
});
const grid=surface.querySelector('.lb-grid'),dots=Array.from(surface.querySelectorAll('[data-lb-dot]'));
dots.forEach((dot,index)=>on(dot,'click',()=>{if(!cards[index])return;grid.scrollTo({left:cards[index].offsetLeft-cards[0].offsetLeft,behavior:reducedMotion||paused?'instant':'smooth'});dots.forEach(item=>item.setAttribute('aria-pressed',String(item===dot)));}));
if(grid)on(grid,'scroll',()=>{const nearest=cards.reduce((best,card,index)=>Math.abs(card.offsetLeft-cards[0].offsetLeft-grid.scrollLeft)<Math.abs(cards[best].offsetLeft-cards[0].offsetLeft-grid.scrollLeft)?index:best,0);dots.forEach((dot,index)=>dot.setAttribute('aria-pressed',String(index===nearest)));});
return{resume(){paused=false;surface.dataset.paused='false';},pause(){paused=true;surface.dataset.paused='true';},destroy(){controller.abort();reveal(null);pinned=null;delete surface.dataset.paused;delete surface.dataset.reducedMotion;}};
}
Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- Photography, lookbooks or collections; sample photographs are from Codrops ColumnScroll, which credits Unsplash.
Interaction
- Mouse, keyboard and touch use the same state; the online preview shows portrait photography.
Touch and accessibility
- Reduced motion shows the result directly; mobile retains usable controls and normal page scrolling.
Setup notes for this effect
The sample imagery is for project context; use images you have rights to and test against the actual theme.
Before launch
Integration files
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Original Codrops interaction referenceDirection detection adapted from Codrops LookbookHoverEffects (MIT). Images are from Codrops ColumnScroll, whose repository credits Unsplash; they are not client project imagery.
Shopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseSwitch density on the same ordered result set, count columns and retain browsing position. Reappearing filtered products point to list-state reconstruction, not a column-count issue.
Large and compact meant two and four columns at 908 px, but one and two at 316 px. A density setting does not imply a fixed column count.
Reproduce the test and inspect the readings
Select large, compact and large again, counting computed grid columns.
- 908 px, both preferences
- 2 then 4 then 2
- 316 px, both preferences
- 1 then 2 then 1
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
View the phone and desktop observations
WESWOO · 24 November 2026. We enabled reduced motion at phone width and used the default motion setting at desktop width. These observations come from the live example.
| Window / preview width | Action | Observed result |
|---|---|---|
| 390 / 316 px | Compact | The selected or expanded control read “Compact”. |
| 1440 / 908 px | Compact | The selected or expanded control read “Compact”. |
See the WESWOO test and results
Select Large and Compact inside the preview. Compare the column count and captions. Window width and the inner demo width are recorded separately because the surrounding page occupies space.
| Window / inner preview | Large to Compact |
|---|---|
| 1440 / 908 px | 2 to 4 columns |
| 390 / 316 px | 1 to 2 columns |
| Caption order at both widths | Shokz, Termino, INIU, FMS |
Reduced motion was on. The observations cover column count and content order. Test product recognition with the store’s actual images.
Preparing preview
How the effect works
Observed result
How many columns does Compact actually add? On the same page the desktop preview went from two columns to four. The phone preview went from one to two. All four projects stayed in the same order.
Two ways to browse the same images
Large cards make details easier to see. Compact cards show more projects at a glance. Each image stays in the same reading order when you switch.
Example source code
View 3 source filesHTML · CSS · MJS
<section class="fx density" lang="en" aria-label="Gallery density demo">
<header><h2>Project gallery</h2><div class="density-switch" role="group" aria-label="Gallery layout">
<button type="button" data-layout="large" aria-pressed="true">Large</button>
<button type="button" data-layout="compact" aria-pressed="false">Compact</button>
</div></header>
<div class="density-grid" data-layout="large"><figure><img src="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp" alt="Shokz website screenshot"><figcaption>Shokz</figcaption></figure><figure><img src="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/termino-preview.webp" alt="Termino website screenshot"><figcaption>Termino</figcaption></figure><figure><img src="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp" alt="INIU website screenshot"><figcaption>INIU</figcaption></figure><figure><img src="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/fms-preview.webp" alt="FMS website screenshot"><figcaption>FMS</figcaption></figure></div>
</section>* { box-sizing: border-box; }
.fx {
color: #f8f7ed; background: #18211e; min-height: 270px;
padding: clamp(16px, 4vw, 40px); font: 16px/1.55 system-ui, sans-serif;
}
h2, h3, p, figure { margin: 0; }
h2 { font-size: clamp(1.4rem, 4vw, 2.4rem); line-height: 1.08; letter-spacing: -.035em; }
p { max-width: 58ch; }
button { font: inherit; cursor: pointer; min-height: 44px; }
button:focus-visible { outline: 2px solid #ffe78f; outline-offset: 3px; }
img { display: block; width: 100%; height: auto; }
[hidden] { display: none !important; }
.density { background: #202318; overflow: hidden; }
.density header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.density-switch { display: flex; flex-wrap: wrap; gap: 6px; }
.density-switch button { background: transparent; color: #fff; border: 1px solid #aaa99d; padding: 6px 14px; border-radius: 6px; }
.density-switch [aria-pressed="true"] { color: #202318; background: #ebebc7; border-color: #ebebc7; font-weight: 650; }
.density-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(10px, 2vw, 18px); margin-top: 18px; }
.density-grid[data-layout="compact"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.density-grid figure { min-width: 0; overflow: hidden; border-radius: 8px; background: #323725; transform-origin: left top; }
.density-grid img { aspect-ratio: 2 / 1; object-fit: cover; object-position: 50% 25%; background: #4c513e; }
.density-grid figcaption { padding: 7px 9px; font-size: .8rem; overflow-wrap: anywhere; }
@media (max-width: 540px) {
.density-grid { grid-template-columns: minmax(0, 1fr); }
.density-grid[data-layout="compact"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}/*
MIT License
Copyright (c) 2009 - 2022 [Codrops](https://tympanus.net/codrops)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
// Codrops' before/after layout approach, implemented with the Web Animations API.
export function mountEffect(root, {reducedMotion = matchMedia('(prefers-reduced-motion: reduce)').matches} = {}) {
const lifetime = new AbortController();
const grid = root.querySelector('.density-grid');
const cards = [...grid.children];
const buttons = [...root.querySelectorAll('button[data-layout]')];
const animations = new Map();
let motion = false;
function stopAnimations() {
animations.forEach(animation => animation.cancel());
animations.clear();
}
function switchLayout(button) {
const target = button.dataset.layout;
if (grid.dataset.layout === target) return;
const before = cards.map(card => card.getBoundingClientRect());
stopAnimations();
grid.dataset.layout = target;
buttons.forEach(control => control.setAttribute('aria-pressed', String(control === button)));
if (!motion || !Element.prototype.animate) return;
cards.forEach((card, index) => {
const first = before[index];
const last = card.getBoundingClientRect();
if (!last.width || !last.height) return;
const animation = card.animate([
{ transform: 'translate(' + (first.left - last.left) + 'px, ' + (first.top - last.top) + 'px) scale('
+ first.width / last.width + ', ' + first.height / last.height + ')' },
{ transform:'none' }
], {duration:380, easing:'cubic-bezier(.2,.75,.25,1)'});
animations.set(card, animation);
animation.onfinish = () => animations.delete(card);
});
}
buttons.forEach(button => button.addEventListener('click', () => switchLayout(button), {signal:lifetime.signal}));
return {
resume() { motion = !reducedMotion; },
pause() { motion = false; stopAnimations(); },
destroy() { lifetime.abort(); stopAnimations(); }
};
}Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- Project galleries, style collections and theme listings.
Interaction
- Measure the cards, switch the CSS Grid columns and animate each card from its former position.
Touch and accessibility
- Phones switch between one and two columns. Reduced motion applies the new layout immediately.
Setup notes for this effect
Keep card links and DOM order intact and let the layout mode change the column count.
Before launch
Integration files
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Codrops source and notesOriginal Codrops demoLayout motion follows Iqbal Muthahhary’s tutorial and Codrops’ open source examples. The screenshots show published WESWOO projects.
Shopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseCompare matching IDs, visible cards and total after the transition. Check filtering and stale responses before investigating hidden styles.
Filtering four items to two and resetting restored all four. The return step catches products that disappear permanently after the first filter.
Reproduce the test and inspect the readings
Switch from all products to warm tones and back to all, reading the result count.
- 908 and 316 px, both preferences
- 4 products then 2 products then 4 products
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
View the phone and desktop observations
WESWOO · 24 November 2026. We enabled reduced motion at phone width and used the default motion setting at desktop width. These observations come from the live example.
| Window / preview width | Action | Observed result |
|---|---|---|
| 390 / 316 px | Warm tones | Selecting Warm tones narrowed four products to two, Rose tee and Ochre tee. |
| 1440 / 908 px | Warm tones | Selecting Warm tones narrowed four products to two, Rose tee and Ochre tee. |
Preparing preview
How the effect works
Make the new results easy to read
Try Warm tones and Cool tones. Hidden items leave the reading order immediately, while the remaining cards move and the count updates.
Example source code
View 3 source filesHTML · CSS · MJS
<section class="fx filter-demo" lang="en" aria-label="Collection filter preview">
<h2>Shop by color</h2>
<div class="filter-actions" role="group" aria-label="Color family">
<button type="button" data-filter="all" aria-pressed="true">All</button>
<button type="button" data-filter="warm" aria-pressed="false">Warm tones</button>
<button type="button" data-filter="cool" aria-pressed="false">Cool tones</button>
</div>
<p class="filter-count" role="status">4 products</p>
<ul class="filter-cards"><li data-tone="cool"><figure><img src="__WW_VISUAL_1__" alt="Front of a sky T-shirt"><figcaption>Sky blue tee</figcaption></figure></li>
<li data-tone="warm"><figure><img src="__WW_VISUAL_2__" alt="Front of a rose T-shirt"><figcaption>Rose tee</figcaption></figure></li>
<li data-tone="warm"><figure><img src="__WW_VISUAL_3__" alt="Front of a ochre T-shirt"><figcaption>Ochre tee</figcaption></figure></li>
<li data-tone="cool"><figure><img src="__WW_VISUAL_4__" alt="Front of a sage T-shirt"><figcaption>Sage tee</figcaption></figure></li></ul>
</section>* { box-sizing: border-box; }
.fx {
--ink: #1d2825; --paper: #f2f1eb; --edge: #c3cac0;
min-height: 270px; padding: clamp(16px,4vw,40px); color: var(--ink);
background: var(--paper); font: 16px/1.45 system-ui, sans-serif;
}
h2,h3,p,figure { margin: 0; }
h2 { font-size: clamp(1.45rem,4vw,2.75rem); line-height: 1.1; letter-spacing: -.035em; }
img { display: block; max-width: 100%; }
button,input { font: inherit; }
button { min-height: 44px; cursor: pointer; border-radius: 8px; padding: 7px 13px; }
button:focus-visible,input:focus-visible { outline: 2px solid #006d62; outline-offset: 2px; }
[hidden] { display: none !important; }
.filter-demo { --paper: #eef0e8; }
.filter-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 17px; }
.filter-actions button { background: #fdfcf6; color: #233932; border: 1px solid #829489; }
.filter-actions [aria-pressed=true] { background: #214941; color: #fff; border-color: #214941; }
.filter-count { color: #4e6558; margin: 12px 0 8px; }
.filter-cards { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: clamp(8px,2vw,16px); list-style: none; padding: 0; margin: 0; }
.filter-cards li { min-width: 0; border-radius: 10px; background: #fffdf8; overflow: hidden; }
.filter-cards img { width: 100%; height: clamp(90px,20vw,185px); padding: 10px; object-fit: contain; background: #f5f3ed; }
.filter-cards figcaption { padding: 7px 9px; font-size: .875rem; overflow-wrap: anywhere; }
@media (max-width: 630px) { .filter-cards { grid-template-columns: repeat(2,minmax(0,1fr)); } }// Independent CSS Grid and Web Animations adaptation of the Codrops filter demo.
export function mountEffect(root, {reducedMotion = matchMedia('(prefers-reduced-motion: reduce)').matches} = {}) {
const lifetime = new AbortController();
const cards = [...root.querySelectorAll('[data-tone]')];
const controls = [...root.querySelectorAll('[data-filter]')];
const count = root.querySelector('.filter-count');
let motion = false;
function stopAnimation() {
for (const card of cards) card.getAnimations?.().forEach(animation => animation.cancel());
}
function applyFilter(button) {
if (button.getAttribute('aria-pressed') === 'true') return;
stopAnimation();
const positions = new Map(cards.filter(card => !card.hidden).map(card => [card, card.getBoundingClientRect()]));
const tone = button.dataset.filter;
let matches = 0;
for (const card of cards) {
card.hidden = tone !== 'all' && tone !== card.dataset.tone;
if (!card.hidden) matches++;
}
controls.forEach(control => control.setAttribute('aria-pressed', String(control === button)));
count.textContent = matches === 1 ? '1 product' : matches + ' products';
if (!motion || !Element.prototype.animate) return;
for (const card of cards.filter(card => !card.hidden)) {
const previous = positions.get(card);
const current = card.getBoundingClientRect();
const from = previous
? {transform:'translate(' + (previous.x-current.x) + 'px,' + (previous.y-current.y) + 'px)'}
: {transform:'translateY(7px)',opacity:0};
card.animate([from,{transform:'none',opacity:1}], {duration:290,easing:'ease-out'});
}
}
controls.forEach(button => button.addEventListener('click', () => applyFilter(button), {signal:lifetime.signal}));
return {
resume() { motion = !reducedMotion; },
pause() { motion = false; stopAnimation(); },
destroy() { lifetime.abort(); stopAnimation(); }
};
}Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- Collections, product lines and lookbooks with filters.
Interaction
- Update visible products and their count. Animate only the cards the shopper can still see.
Touch and accessibility
- Tap a filter on mobile. Reduced motion applies the results immediately.
Setup notes for this effect
Use Shopify to supply the collection results and keep filter state in the URL.
Before launch
Integration files
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Codrops source and notesOriginal Codrops demoThe filter follows Codrops Filterable Product Grid. Product visuals come from the original Codrops Product Grid Layout.
Shopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseOffer a tap control for front and back. Switch to the rear view, then change color and verify the rear image also belongs to the new variant.
Both switches updated the status. For similar-looking images, the front and back labels provide a second check on the selected control.
Reproduce the test and inspect the readings
Switch front to back and back to front. Read the current-view status.
- 908 and 316 px, both preferences
- Front view then Back view then Front view
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
View the phone and desktop observations
WESWOO · 24 November 2026. We enabled reduced motion at phone width and used the default motion setting at desktop width. These observations come from the live example.
| Window / preview width | Action | Observed result |
|---|---|---|
| 390 / 316 px | Back | Previously “Front view”. The interface showed “Back view”. |
| 1440 / 908 px | Back | Previously “Front view”. The interface showed “Back view”. |
Preparing preview
How the effect works
Let shoppers decide when to look at the back
A garment may have a back print or a device may have ports. Give each side a labeled control so shoppers can inspect it on demand.
Example source code
View 3 source filesHTML · CSS · MJS
<section class="fx angle-demo" lang="en" aria-label="Product front and back preview">
<div class="angle-copy">
<h2>Sky blue tee</h2>
<p>Check the graphic and the print placement from both sides.</p>
<div class="angle-actions" role="group" aria-label="Product view">
<button type="button" data-side="front" aria-pressed="true">Front</button>
<button type="button" data-side="back" aria-pressed="false">Back</button>
</div>
</div>
<figure class="angle-figure">
<div class="angle-scene">
<div class="angle-flip">
<img class="angle-front" src="__WW_VISUAL_1__" alt="Front of a sky blue T-shirt with a drop graphic">
<img class="angle-back" src="__WW_VISUAL_2__" alt="Back of the same T-shirt with a small Codrops wordmark" aria-hidden="true">
</div>
</div>
<figcaption role="status">Front view</figcaption>
</figure>
</section>* { box-sizing: border-box; }
.fx {
--ink: #1d2825; --paper: #f2f1eb; --edge: #c3cac0;
min-height: 270px; padding: clamp(16px,4vw,40px); color: var(--ink);
background: var(--paper); font: 16px/1.45 system-ui, sans-serif;
}
h2,h3,p,figure { margin: 0; }
h2 { font-size: clamp(1.45rem,4vw,2.75rem); line-height: 1.1; letter-spacing: -.035em; }
img { display: block; max-width: 100%; }
button,input { font: inherit; }
button { min-height: 44px; cursor: pointer; border-radius: 8px; padding: 7px 13px; }
button:focus-visible,input:focus-visible { outline: 2px solid #006d62; outline-offset: 2px; }
[hidden] { display: none !important; }
/* Paired front/back faces adapted from Codrops ProductGridLayout (2013). */
.angle-demo { display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); gap: clamp(14px,4vw,40px); align-items: center; }
.angle-copy p { color: #465c56; margin-top: 9px; max-width: 31ch; }
.angle-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.angle-actions button { background: #fffdfa; border: 1px solid #738b84; color: #1e403a; }
.angle-actions [aria-pressed=true] { background: #214941; border-color: #214941; color: #fff; }
.angle-figure { border-radius: 12px; padding: clamp(10px,3vw,23px); background: #dce9e6; }
.angle-scene { perspective: 950px; }
.angle-flip { display: grid; transform-style: preserve-3d; transition: none; }
.fx[data-motion=on] .angle-flip { transition: transform 380ms cubic-bezier(.2,.7,.2,1); }
.angle-flip.show-back { transform: rotateY(180deg); }
.angle-flip img { grid-area: 1 / 1; width: 100%; height: clamp(165px,31vw,340px); object-fit: contain; backface-visibility: hidden; }
.angle-back { transform: rotateY(180deg); }
.angle-figure figcaption { text-align: center; margin-top: 7px; color: #39564b; font-weight: 650; }
@media (max-width: 650px) { .angle-demo { grid-template-columns: minmax(0,1fr); } }/*
* ProductGridLayout, Copyright (c) 2013 Codrops.
* Adapted from cbpShop.js, released under the MIT license.
* https://github.com/codrops/ProductGridLayout/blob/master/js/cbpShop.js
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
export function mountEffect(root, {reducedMotion = matchMedia('(prefers-reduced-motion: reduce)').matches} = {}) {
const lifetime = new AbortController();
const flip = root.querySelector('.angle-flip');
const front = root.querySelector('.angle-front');
const back = root.querySelector('.angle-back');
const label = root.querySelector('figcaption');
const controls = [...root.querySelectorAll('button[data-side]')];
function setSide(button) {
const showBack = button.dataset.side === 'back';
flip.classList.toggle('show-back', showBack);
front.setAttribute('aria-hidden', String(showBack));
back.setAttribute('aria-hidden', String(!showBack));
label.textContent = showBack ? 'Back view' : 'Front view';
controls.forEach(control => control.setAttribute('aria-pressed', String(control === button)));
}
controls.forEach(button => button.addEventListener('click', () => setSide(button), {signal:lifetime.signal}));
return {
resume() { root.dataset.motion = reducedMotion ? 'off' : 'on'; },
pause() { root.dataset.motion = 'off'; },
destroy() { lifetime.abort(); delete root.dataset.motion; }
};
}Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- Apparel prints, equipment back panels and accessory ports.
Interaction
- Both images share a fixed frame. A button selects the side, and the caption names the active view.
Touch and accessibility
- Touch and keyboard use the same controls. Reduced motion swaps the view immediately.
Setup notes for this effect
Use front and back photographs for the selected variant and give both a useful alternative description.
Before launch
Integration files
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Codrops source and notesOriginal Codrops demoAdapted from the MIT-licensed Codrops Product Grid Layout code, using both product views from the original demo.
Shopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseFill both comparison slots, try a third and remove one selection. If the table retains the removed model, inspect whether it reads the same selection state.
One selection left comparison disabled. Selecting Sky and Rose enabled it and produced those two named products.
Reproduce the test and inspect the readings
Select one item, then a second, check button availability and open the result to read both product names.
- 908 and 316 px, both preferences
- disabled then enabled then Sky tee / Rose tee
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
View the phone and desktop observations
WESWOO · 24 November 2026. We enabled reduced motion at phone width and used the default motion setting at desktop width. These observations come from the live example.
| Window / preview width | Action | Observed result |
|---|---|---|
| 390 / 316 px | Sky | Previously “0 of 2 selected”. The interface showed “1 of 2 selected”. |
| 1440 / 908 px | Sky | Previously “0 of 2 selected”. The interface showed “1 of 2 selected”. |
Preparing preview
How the effect works
Align the same attribute on one row
Select two items and open the comparison. Read each shared attribute across one row.
Example source code
View 3 source filesHTML · CSS · MJS
<section class="fx compare-demo" lang="en" aria-label="Shortlist comparison demo">
<h2>Compare two products</h2>
<p class="intro">Select two tees to compare their sample specifications.</p>
<div class="shortlist" role="group" aria-label="Products to compare"><label><img class="product-photo" src="__WW_VISUAL_1__" alt=""><span><input type="checkbox" data-option="1"> Sky</span></label>
<label><img class="product-photo" src="__WW_VISUAL_2__" alt=""><span><input type="checkbox" data-option="2"> Rose</span></label>
<label><img class="product-photo" src="__WW_VISUAL_3__" alt=""><span><input type="checkbox" data-option="3"> Sage</span></label></div>
<p class="status" role="status" data-selected>0 of 2 selected</p>
<button type="button" class="primary compare-action" data-compare disabled>Compare selected</button>
<div class="panel compare-result" hidden>
<table><caption tabindex="-1">Sample specifications</caption><thead><tr>
<th scope="col">Feature</th><th scope="col" data-name></th><th scope="col" data-name></th>
</tr></thead><tbody>
<tr><th scope="row">Color</th><td data-value></td><td data-value></td></tr>
<tr><th scope="row">Sample fit</th><td data-value></td><td data-value></td></tr>
<tr><th scope="row">Sample price</th><td data-value></td><td data-value></td></tr>
</tbody></table>
<button type="button" data-edit>Edit selection</button>
</div>
</section>* { box-sizing: border-box; }
.fx {
--paper:#f2f3eb; --ink:#20332b; --accent:#205a4c; --edge:#c6cec0; --card:#fffdf8; --mute:#466056;
padding:clamp(14px,3.3vw,34px); min-height:268px; color:var(--ink); background:var(--paper);
font:16px/1.48 system-ui,sans-serif;
}
h2,h3,p,figure,ul,ol,dl,dd,fieldset { margin:0; }
h2 { font-size:clamp(1.38rem,3.8vw,2.55rem); letter-spacing:-.035em; line-height:1.1; }
h3 { font-size:1.12em; }
p { max-width:62ch; }
img { display:block; max-width:100%; }
button,input,select { font:inherit; }
button {
min-height:44px; padding:8px 12px; border:1px solid var(--edge); border-radius:8px;
background:var(--card); color:var(--ink); cursor:pointer; line-height:1.25;
}
button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible,[tabindex="0"]:focus-visible {
outline:2px solid var(--accent); outline-offset:2px;
}
button:disabled { opacity:.55; cursor:default; }
button[aria-pressed="true"],button.primary { color:white; background:var(--accent); border-color:var(--accent); font-weight:650; }
button:hover:not(:disabled) { border-color:var(--accent); }
[hidden] { display:none !important; }
.intro { margin:8px 0 15px; color:var(--mute); }
.panel { padding:clamp(10px,2.2vw,22px); border:1px solid var(--edge); border-radius:12px; background:var(--card); }
.row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.cols { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:clamp(12px,3vw,28px); align-items:start; }
.product-photo { width:100%; height:clamp(94px,21vw,204px); object-fit:contain; padding:10px; border-radius:10px; background:#e6e9e1; }
.status { color:var(--mute); margin-top:10px; min-height:1.45em; }
@media(max-width:600px){ .cols { grid-template-columns:minmax(0,1fr); } }
.compare-demo { --paper:#eef2ef; }
.shortlist { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
.shortlist label { display:flex; flex-direction:column; gap:4px; cursor:pointer; border-radius:10px;
padding:4px; border:1px solid var(--edge); background:var(--card); }
.shortlist label:has(:checked) { border-color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent); }
.shortlist img { height:clamp(58px,14vw,160px); }
.shortlist span { display:flex; gap:3px; align-items:center; min-height:44px; overflow-wrap:anywhere; }
.shortlist input { width:16px; height:16px; flex:none; accent-color:var(--accent); }
.compare-action,.compare-result { margin-top:8px; }
.compare-result table { table-layout:fixed; width:100%; border-collapse:collapse; margin-bottom:12px; font-size:.88em; }
.compare-result caption { text-align:left; font-weight:700; }
.compare-result th,.compare-result td { padding:6px 3px; text-align:left; overflow-wrap:anywhere; border-bottom:1px solid var(--edge); }export function mountEffect(root, {reducedMotion = matchMedia('(prefers-reduced-motion: reduce)').matches} = {}) {
const lifetime = new AbortController();
const $ = selector => root.querySelector(selector);
const all = selector => [...root.querySelectorAll(selector)];
const listen = (element, type, handler) => element.addEventListener(type, handler, {signal:lifetime.signal});
const animations = new Map();
let motion = false;
function cancelMotion() {
for (const animation of animations.values()) animation.cancel();
animations.clear();
}
function reveal(element, position = 'translateY(6px)') {
animations.get(element)?.cancel();
if (!motion || !element.animate) return;
const animation = element.animate(
[{transform:position, opacity:.52},{transform:'none', opacity:1}],
{duration:225, easing:'ease-out'}
);
animations.set(element,animation);
animation.onfinish = () => animations.delete(element);
}
const options = all('[data-option]');
const count = $('[data-selected]');
const action = $('[data-compare]');
const panel = $('.compare-result');
const records = {
1:['Sky tee','Sky blue','Regular','$24'],
2:['Rose tee','Rose','Relaxed','$26'],
3:['Sage tee','Sage','Regular','$24']
};
const selected = () => options.filter(option => option.checked);
function update() {
const picks = selected();
count.textContent = picks.length + ' of 2 selected';
action.disabled = picks.length !== 2;
options.forEach(option => { option.disabled = picks.length === 2 && !option.checked; });
}
for (const option of options) listen(option,'change',update);
listen(action,'click',() => {
const picks = selected().map(option => records[option.dataset.option]);
if (picks.length !== 2) return;
all('[data-name]').forEach((cell,i) => { cell.textContent = picks[i][0]; });
all('[data-value]').forEach((cell,i) => { cell.textContent = picks[i%2][Math.floor(i/2)+1]; });
panel.hidden = false;
$('.shortlist').hidden = action.hidden = count.hidden = true;
$('caption').focus({preventScroll:true});
reveal(panel);
});
listen($('[data-edit]'),'click',() => {
panel.hidden = true;
$('.shortlist').hidden = action.hidden = count.hidden = false;
action.focus({preventScroll:true});
});
return {
resume() { motion = !reducedMotion; },
pause() { motion = false; cancelMotion(); },
destroy() { lifetime.abort(); cancelMotion(); }
};
}Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- Collections where shoppers compare fit, materials or technical specs.
Interaction
- Limit the shortlist to two items and populate a common set of comparison fields.
Touch and accessibility
- Use checkboxes and a semantic table. Move focus to the table when it opens.
Setup notes for this effect
Generate the rows from common product metafields and keep it easy to replace a selection.
Before launch
Integration files
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Interaction sourceOriginal Codrops demoThe shortlist pattern follows Codrops Product Comparison. Product photos are from Codrops Product Grid Layout.
Shopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseA collection says products failed to load. How can I tell two causes apart?
Read the failed request’s status, content type and body. We served the same list a 503, then HTML with a 200, then valid JSON. Both failures preserved A. A valid response appended B and repeating it did not append a second B.
Establish whether this endpoint promises JSON or rendered theme-section HTML before choosing the parser. Record the observed status and type, keep earlier results visible and follow the endpoint’s retry contract.
Compare results, scope and replay code
503 and 200 HTML yielded HTTP 503 and Unexpected content type respectively. Visible items remained A.
After valid JSON and a repeated request, the list remained A, B.
This fixture endpoint promises JSON. A Shopify endpoint designed to return section HTML needs a different test. The original post supplied no failing response, so its root cause remains undetermined.
async function loadNext(url) {
const res=await fetch(url,{headers:{Accept:'application/json'}});
if(!res.ok)throw Error('HTTP '+res.status);
if(!res.headers.get('content-type')?.includes('application/json'))throw Error('Unexpected content type');
const data=await res.json();
if(!Array.isArray(data.items))throw Error('Missing items');
return data.items;
} WESWOO tested Chrome 157.0.8103.79. In a clean directory with Node.js 22 or newer, run npm install playwright, then npx playwright install chromium, then node weswoo-retry.cjs.
Original question · Shopify · Section Rendering API · MDN · Response.ok
Load more repeats the first products. Which two parts of the request should I compare?
Compare the initial and next request URLs, especially page and sort. Follow the server’s next link and compare IDs before and after appending. If the response already contains repeats, investigate the source.
A local server offered two sorted pages. We repeated page one, requested page two without its sort, and followed the full next link.
Compare results, scope and replay code
Both broken requests produced P1, P1. The full next link yielded P1, P2, P3, and the last response carried no next link.
This separate question reports duplicate items. An earlier post reported a delayed error with no response capture. The two symptoms have different evidence requirements. This fixture does not identify either store’s backend.
Tested in Chrome 157.0.8103.79. In a clean directory with Node.js 22 or later run, in order, npm install playwright → npx playwright install chromium → node weswoo-next-products.cjs.
Original question · Shopify · paginate · Shopify · Section Rendering API
Fail the second page, retain the first and retry the same cursor twice. The demo preserves old items on failure. A live paginator must also handle duplicate and reordered successful responses.
The failed request preserved both existing items. Retry produced four. A successful load alone cannot reveal whether failure clears the original list.
Reproduce the test and inspect the readings
With two results visible, simulate a failed load, clear the failure and retry. Count visible items each time.
- 908 and 316 px, both preferences
- 2 then 2 then 4
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
View the phone and desktop observations
WESWOO · 24 November 2026. We enabled reduced motion at phone width and used the default motion setting at desktop width. These observations come from the live example.
| Window / preview width | Action | Observed result |
|---|---|---|
| 390 / 316 px | Load more | Load more kept Shokz and Termino in place, appended INIU and FMS, and reported four of four examples. |
| 1440 / 908 px | Load more | Load more kept Shokz and Termino in place, appended INIU and FMS, and reported four of four examples. |
Preparing preview
How the effect works
Keep the items shoppers already found
Enable the failure simulation and choose Load more. Retry without losing the two visible results.
Example source code
View 3 source filesHTML · CSS · MJS
<section class="fx load-demo" lang="en" aria-label="Load more results demo">
<h2>Load more results</h2>
<p class="intro">See how a list handles loading and retries without losing its current items.</p>
<ul class="results" aria-busy="false"><li><figure><img src="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/shokz-openfit-preview.webp" alt="Shokz storefront screenshot"><figcaption>Shokz</figcaption></figure></li>
<li><figure><img src="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/termino-preview.webp" alt="Termino storefront screenshot"><figcaption>Termino</figcaption></figure></li>
<li hidden><figure><img src="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/iniu-preview.webp" alt="INIU storefront screenshot"><figcaption>INIU</figcaption></figure></li>
<li hidden><figure><img src="https://www.weswoo.com/wp-content/themes/weswoo/assets/images/case-brands/project-previews/fms-preview.webp" alt="FMS storefront screenshot"><figcaption>FMS</figcaption></figure></li></ul>
<p class="status" role="status" data-status>Showing 2 of 4 examples.</p>
<div class="row loader-actions">
<button type="button" class="primary" data-load>Load more</button>
<label><input type="checkbox" data-failure> Simulate a failed request</label>
</div>
</section>* { box-sizing: border-box; }
.fx {
--paper:#f2f3eb; --ink:#20332b; --accent:#205a4c; --edge:#c6cec0; --card:#fffdf8; --mute:#466056;
padding:clamp(14px,3.3vw,34px); min-height:268px; color:var(--ink); background:var(--paper);
font:16px/1.48 system-ui,sans-serif;
}
h2,h3,p,figure,ul,ol,dl,dd,fieldset { margin:0; }
h2 { font-size:clamp(1.38rem,3.8vw,2.55rem); letter-spacing:-.035em; line-height:1.1; }
h3 { font-size:1.12em; }
p { max-width:62ch; }
img { display:block; max-width:100%; }
button,input,select { font:inherit; }
button {
min-height:44px; padding:8px 12px; border:1px solid var(--edge); border-radius:8px;
background:var(--card); color:var(--ink); cursor:pointer; line-height:1.25;
}
button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible,[tabindex="0"]:focus-visible {
outline:2px solid var(--accent); outline-offset:2px;
}
button:disabled { opacity:.55; cursor:default; }
button[aria-pressed="true"],button.primary { color:white; background:var(--accent); border-color:var(--accent); font-weight:650; }
button:hover:not(:disabled) { border-color:var(--accent); }
[hidden] { display:none !important; }
.intro { margin:8px 0 15px; color:var(--mute); }
.panel { padding:clamp(10px,2.2vw,22px); border:1px solid var(--edge); border-radius:12px; background:var(--card); }
.row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.cols { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:clamp(12px,3vw,28px); align-items:start; }
.product-photo { width:100%; height:clamp(94px,21vw,204px); object-fit:contain; padding:10px; border-radius:10px; background:#e6e9e1; }
.status { color:var(--mute); margin-top:10px; min-height:1.45em; }
@media(max-width:600px){ .cols { grid-template-columns:minmax(0,1fr); } }
.load-demo { --paper:#eeece7; --accent:#52426c; }
.results { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); padding:0; list-style:none; gap:8px; }
.results li { border-radius:9px; overflow:hidden; background:var(--card); }
.results img { width:100%; aspect-ratio:2/1; object-fit:cover; }
.results figcaption { padding:5px 8px; }
.loader-actions { margin-top:8px; }
.loader-actions label { display:flex; align-items:center; gap:5px; min-height:44px; }
.loader-actions input { width:17px; height:17px; }export function mountEffect(root, {reducedMotion = matchMedia('(prefers-reduced-motion: reduce)').matches} = {}) {
const lifetime = new AbortController();
const $ = selector => root.querySelector(selector);
const all = selector => [...root.querySelectorAll(selector)];
const listen = (element, type, handler) => element.addEventListener(type, handler, {signal:lifetime.signal});
const animations = new Map();
let motion = false;
function cancelMotion() {
for (const animation of animations.values()) animation.cancel();
animations.clear();
}
function reveal(element, position = 'translateY(6px)') {
animations.get(element)?.cancel();
if (!motion || !element.animate) return;
const animation = element.animate(
[{transform:position, opacity:.52},{transform:'none', opacity:1}],
{duration:225, easing:'ease-out'}
);
animations.set(element,animation);
animation.onfinish = () => animations.delete(element);
}
const list = $('.results');
const load = $('[data-load]');
const failure = $('[data-failure]');
const status = $('[data-status]');
let busy = false;
let finished = false;
let timer;
listen(load,'click',() => {
if (busy || finished) return;
const shouldFail = failure.checked;
busy = true;
load.setAttribute('aria-disabled','true');
failure.disabled = true;
list.setAttribute('aria-busy','true');
status.textContent = 'Loading more results…';
timer = window.setTimeout(() => {
busy = false;
failure.disabled = false;
list.setAttribute('aria-busy','false');
if (shouldFail) {
failure.checked = false;
load.textContent = 'Retry';
status.textContent = 'Could not load more. Your current results are still visible.';
load.removeAttribute('aria-disabled');
return;
}
finished = true;
for (const item of all('.results li[hidden]')) {
item.hidden = false;
reveal(item);
}
load.textContent = 'All results loaded';
load.disabled = true;
status.textContent = 'Showing 4 of 4 examples.';
},480);
});
return {
resume() { motion = !reducedMotion; },
pause() { motion = false; cancelMotion(); },
destroy() { lifetime.abort(); cancelMotion(); window.clearTimeout(timer); }
};
}Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- Load-more controls, result refreshes and project lists.
Interaction
- Block repeat requests, retain previous results on failure and append on success.
Touch and accessibility
- Loading and errors use text; added results appear immediately with reduced motion.
Setup notes for this effect
Replace the sample delay with a real pagination request and preserve already-rendered products.
Before launch
Integration files
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Interaction sourceLoading feedback refers to Codrops; the preview uses real WESWOO project screenshots.
Shopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · licenseVerify reload, sign-out and another signed-in device separately. This example toggles page state. A changed icon does not establish an account write or cross-device synchronization.
The second action restored the empty list. The result demonstrates reversibility; cross-device persistence depends on the storage implementation.
Reproduce the test and inspect the readings
Save one print to an empty list, then remove it and read the list feedback.
- 908 and 316 px, both preferences
- Your list is empty. then Meadow, in bloom · 1 print then Your list is empty.
WESWOO loaded this example’s published HTML, CSS and JavaScript in standalone Chrome at 700 px viewport height. Both motion preferences were tested at each width.
2026-11-24 · Chrome 157.0.8103.79
View the phone and desktop observations
WESWOO · 24 November 2026. We enabled reduced motion at phone width and used the default motion setting at desktop width. These observations come from the live example.
| Window / preview width | Action | Observed result |
|---|---|---|
| 390 / 316 px | ♡ Save print | Previously “Your list is empty.”. The interface showed “Meadow, in bloom · 1 print”. |
| 1440 / 908 px | ♡ Save print | Previously “Your list is empty.”. The interface showed “Meadow, in bloom · 1 print”. |
Preparing preview
How the effect works
Show where the saved item went
Keep the artwork and its dimensions in view while the buyer saves it. Showing its name below the control makes the result easy to find.
Example source code
View 3 source filesHTML · CSS · MJS
<section class="fx wish" lang="en" aria-label="Save a print">
<figure data-stage><img src="__WW_VISUAL_1__" alt="Dandelions swaying in an open meadow"></figure>
<div class="print-info"><p class="eyebrow">FIELD STUDIES / PHOTOGRAPHIC PRINT</p><h2>Meadow, in bloom</h2>
<p class="print-size">Archival print · 30 × 40 cm</p>
<button data-save aria-pressed="false"><span aria-hidden="true">♡</span> Save print</button>
<div class="saved-list"><h3>Saved prints</h3><p data-list role="status">Your list is empty.</p></div></div>
</section>* { box-sizing: border-box; }
.fx {
--paper:#f2f3eb; --ink:#20332b; --accent:#205a4c; --edge:#c6cec0; --card:#fffdf8; --mute:#466056;
padding:clamp(14px,3.3vw,34px); min-height:268px; color:var(--ink); background:var(--paper);
font:16px/1.48 system-ui,sans-serif;
}
h2,h3,p,figure,ul,ol,dl,dd,fieldset { margin:0; }
h2 { font-size:clamp(1.38rem,3.8vw,2.55rem); letter-spacing:-.035em; line-height:1.1; }
h3 { font-size:1.12em; }
p { max-width:62ch; }
img { display:block; max-width:100%; }
button,input,select { font:inherit; }
button {
min-height:44px; padding:8px 12px; border:1px solid var(--edge); border-radius:8px;
background:var(--card); color:var(--ink); cursor:pointer; line-height:1.25;
}
button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible,[tabindex="0"]:focus-visible {
outline:2px solid var(--accent); outline-offset:2px;
}
button:disabled { opacity:.55; cursor:default; }
button[aria-pressed="true"],button.primary { color:white; background:var(--accent); border-color:var(--accent); font-weight:650; }
button:hover:not(:disabled) { border-color:var(--accent); }
[hidden] { display:none !important; }
.intro { margin:8px 0 15px; color:var(--mute); }
.panel { padding:clamp(10px,2.2vw,22px); border:1px solid var(--edge); border-radius:12px; background:var(--card); }
.row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.cols { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:clamp(12px,3vw,28px); align-items:start; }
.product-photo { width:100%; height:clamp(94px,21vw,204px); object-fit:contain; padding:10px; border-radius:10px; background:#e6e9e1; }
.status { color:var(--mute); margin-top:10px; min-height:1.45em; }
@media(max-width:600px){ .cols { grid-template-columns:minmax(0,1fr); } }
.wish{display:grid;grid-template-columns:1.2fr 1fr;background:#eee9dc;padding:0;color:#273224}
.wish figure{min-height:210px;position:relative;margin:0}.wish figure img{width:100%;height:100%;position:absolute;object-fit:cover}
.print-info{padding:clamp(18px,4vw,42px)}.eyebrow{font:600 11px/1.5 system-ui;letter-spacing:.09em;margin:0 0 12px}
.wish h2{font:normal clamp(26px,4vw,48px)/1.03 Georgia,serif}.print-size{margin:12px 0 17px}.wish button span{font-size:1.35em;vertical-align:middle}
.saved-list{margin-top:22px;padding-top:12px;border-top:1px solid #a6af96}.saved-list h3{font-size:14px}.saved-list p{margin-top:4px}
@media(max-width:520px){.wish{grid-template-columns:1fr}.wish figure{min-height:146px}.print-info{padding:16px}}export function mountEffect(root, {reducedMotion = matchMedia('(prefers-reduced-motion: reduce)').matches} = {}) {
const lifetime = new AbortController();
const $ = selector => root.querySelector(selector);
const all = selector => [...root.querySelectorAll(selector)];
const listen = (element, type, handler) => element.addEventListener(type, handler, {signal:lifetime.signal});
const animations = new Map();
let motion = false;
function cancelMotion() {
for (const animation of animations.values()) animation.cancel();
animations.clear();
}
function reveal(element, position = 'translateY(6px)') {
animations.get(element)?.cancel();
if (!motion || !element.animate) return;
const animation = element.animate(
[{transform:position, opacity:.52},{transform:'none', opacity:1}],
{duration:225, easing:'ease-out'}
);
animations.set(element,animation);
animation.onfinish = () => animations.delete(element);
}
const save = $('[data-save]');
listen(save,'click',()=>{
const on = save.getAttribute('aria-pressed') !== 'true';
save.setAttribute('aria-pressed',String(on));
save.querySelector('span').textContent = on ? '♥' : '♡';
$('[data-list]').textContent = on ? 'Meadow, in bloom · 1 print' : 'Your list is empty.';
reveal(save.querySelector('span'),'scale(.7)');
});
return {
resume() { motion = !reducedMotion; const stage = root.querySelector('[data-stage]'); if (stage) reveal(stage); },
pause() { motion = false; cancelMotion(); },
destroy() { lifetime.abort(); cancelMotion(); }
};
}Integration and checks
Theme integration
3 stepsDuplicate the theme
Integrate and preview the example in a duplicate theme.
Connect the section settings
Replace demo copy and artwork with section settings and scope the styles to that section.
Connect the editor lifecycle
Use the lifecycle script for editor reloads, pausing offscreen and cleanup on unload.
Placement
- Beside a product or artwork.
Interaction
- One Boolean drives the toggle and the list.
Touch and accessibility
- Use the button with touch or a keyboard. The list announces the change.
Setup notes for this effect
This demo keeps state for the current preview. Connect a stable product or variant ID to your wishlist and handle write errors.
Before launch
Integration files
{% comment %} WESWOO example shell. Add ONE effect's HTML inside .fx-slot. {% endcomment %}
{{ 'ww-effects.css' | asset_url | stylesheet_tag }}
<section id="ww-effect-{{ section.id }}" data-ww-effect-section>
<h2>{{ section.settings.heading | escape }}</h2>
<button type="button" data-effect-toggle aria-pressed="false">Play / pause effect</button>
<div class="fx-slot">
{% comment %} Insert the chosen .fx element here; read copy/images from section settings. {% endcomment %}
</div>
</section>
<script type="module" src="{{ 'ww-effect-section.js' | asset_url }}"></script>
{% schema %}
{"name":"WESWOO effect","settings":[{"type":"text","id":"heading","label":"Heading","default":"Our story"}],"presets":[{"name":"WESWOO effect"}]}
{% endschema %}
// Put the chosen example JS in assets/ww-selected-effect.js (rename .mjs to .js).
import {mountEffect} from './ww-selected-effect.js';
const instances=new Map();
function mount(container=document){
const roots=[...(container.matches?.('[data-ww-effect-section]')?[container]:[]),...container.querySelectorAll('[data-ww-effect-section]')];
for(const section of roots){
if(instances.has(section))continue;
const root=section.querySelector('.fx'),button=section.querySelector('[data-effect-toggle]');
if(!root||!button)continue;
const effect=mountEffect(root),events=new AbortController();let playing=false;
const pause=()=>{playing=false;effect.pause();button.setAttribute('aria-pressed','false');};
button.addEventListener('click',()=>{playing=!playing;playing?effect.resume():effect.pause();button.setAttribute('aria-pressed',String(playing));},{signal:events.signal});
const observer=new IntersectionObserver(entries=>{if(!entries[0].isIntersecting)pause();});observer.observe(section);
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:events.signal});
instances.set(section,()=>{observer.disconnect();events.abort();effect.destroy();});
}
}
document.addEventListener('shopify:section:load',event=>mount(event.target));
document.addEventListener('shopify:section:unload',event=>{for(const [section,destroy] of instances)if(section===event.target||event.target.contains(section)){destroy();instances.delete(section);}});
mount();
// Original WESWOO integration. Copy alongside the selected ww-effect-*.js asset.
// The server supplies the asset URL; do not accept a URL from a query parameter.
if (!customElements.get('ww-effect-study')) {
customElements.define('ww-effect-study', class extends HTMLElement {
connectedCallback() {
if (this.events) return;
this.events=new AbortController();this.session={};const session=this.session;
const button=this.querySelector('[data-effect-toggle]');
button.disabled=false;button.setAttribute('aria-pressed','false');this.visible=true;
const preference=matchMedia('(prefers-reduced-motion: reduce)');
const pause=()=>{this.effect?.pause();button.setAttribute('aria-pressed','false');};
this.pause=pause;
button.addEventListener('click',async()=>{
if(this.loading)return;
if(!this.effect){
this.loading=true;button.disabled=true;
try {
const {mountEffect}=await import(this.dataset.moduleUrl);
if(!this.isConnected||this.session!==session)return;
this.effect=mountEffect(this.querySelector('.fx'),{reducedMotion:preference.matches});
} catch {this.querySelector('[data-effect-status]').textContent='The static content is available. Reload to retry motion.';return;}
finally {if(this.session===session){this.loading=false;button.disabled=false;}}
}
if(this.session!==session||document.hidden||!this.visible)return;
const playing=button.getAttribute('aria-pressed')!=='true';
playing?this.effect.resume():this.effect.pause();button.setAttribute('aria-pressed',String(playing));
},{signal:this.events.signal});
document.addEventListener('visibilitychange',()=>{if(document.hidden)pause();},{signal:this.events.signal});
preference.addEventListener('change',()=>{pause();this.effect?.destroy();this.effect=null;},{signal:this.events.signal});
this.observer=new IntersectionObserver(entries=>{this.visible=entries[0].isIntersecting;if(!this.visible)pause();});this.observer.observe(this);
const root=this.querySelector('.fx');
root.querySelectorAll('[data-view]').forEach(trigger=>trigger.addEventListener('click',()=>{const target=root.querySelector('dialog .art'),source=trigger.querySelector('.ww-fx-image');target.querySelector('.ww-fx-image')?.remove();if(source)target.append(source.cloneNode(true));},{signal:this.events.signal}));
// Section unload disconnects this custom element; reconnect mounts one fresh instance.
document.addEventListener('shopify:section:unload',event=>{if(event.target.contains(this))this.teardown();},{signal:this.events.signal});
}
teardown(){this.session=null;this.loading=false;this.observer?.disconnect();this.events?.abort();this.effect?.destroy();this.effect=null;this.events=null;}
disconnectedCallback(){this.teardown();}
});
}
Insert the selected effect into the shell. Each module loads one effect; multiple types need an explicit registry and Section mapping.
Sources and further reading
Reference links
Interaction sourceOriginal Codrops demoInteraction inspired by Codrops Animocons. Meadow still from the original Codrops InlineHoverReveals demo, credited to Pexels.
Shopify: Section architectureShopify: theme editor events and lifecycleShopify: theme performanceMDN: Web Animations APIMDN: reduced-motion preferenceMDN: iframe sandboxingShopify: image rendering and dimensionsShopify: Section settings and schemaMDN: element geometryMDN: image and text clippingMDN: native dialogShopify: theme accessibilityMDN: native range inputScope and licensing
Examples are authored by WESWOO and credited open-source contributors; retain their applicable licenses. Project screens and photographs remain with their rights holders. Downloads use placeholders; replace them with imagery you may use.
Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · license