案例作品集 浏览精选项目

WESWOO 提供 Shopify Plus 项目开发费抵扣,至多 US$4,800

搜索
图库与细节展示

选品后对比规格

只选一件、再选两件、试着选第三件。对比入口何时可用、达到上限怎么提示、取消一件后能否重选,都比按钮颜色更能说明流程是否完整。

选满两个商品再尝试第三个,读出提示并取消其中一个。若比较表里的型号仍是被取消的旧项,查选中清单与比较表是否读取同一份状态。

只选一件时按钮不可用;选 Sky 和 Rose 后能比较,结果确实包含这两款。

复现实验与读数

先选一件再选第二件,读比较按钮是否可用,再打开结果核对商品名。

908、316 px,两种偏好
不可用,再到 可用,再到 Sky tee / Rose tee

WESWOO 在独立 Chrome 窗口载入本页公开示例的 HTML、CSS 和 JavaScript,预览高 700 px。两种宽度下都单独测试默认偏好和减少动态效果。

2026-11-24 · Chrome 157.0.8103.79

下载测试条件与原始读数(JSON)

查看手机与桌面的演示记录

WESWOO · 2026-11-24。手机宽度开启了减少动态效果,桌面宽度使用默认动态设置。下表记录本站正式演示中的界面。

窗口 / 预览宽度操作观察结果
390 / 316 pxSky原为“0 of 2 selected”。操作后显示“1 of 2 selected”。
1440 / 908 pxSky原为“0 of 2 selected”。操作后显示“1 of 2 selected”。

正在准备预览

特效说明

让规格在同一行对得上

选两件商品后打开对比。在同一行读完一个属性,再继续看下一行。

示例源码

查看 3 个源文件HTML · CSS · MJS
product-shortlist-compare.html
<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>

接入与验收

接入主题

3 步
  1. 复制要接入的主题

    在主题副本里接入和预览示例。

  2. 把素材接到区块设置

    将示例文字与图片替换为 Section 设置,并把样式限定在当前 Section。

  3. 绑定编辑器生命周期

    用生命周期脚本处理主题编辑器重载、离屏暂停和卸载清理。

使用位置

  • 需要对比款式、材质或技术参数的集合页。

交互逻辑

  • 限制选两件,再根据选中商品填充同口径数据。

触摸与无障碍

  • 使用普通复选框和语义表格,打开时将焦点移到表格。

本效果的接入说明

用同一组商品元字段生成比较行,推荐支持取消与替换选中商品。

上线检查

接入文件
sections/ww-effect.liquid
{% 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 %}

通用壳层需要填入所选效果。每个模块接入一种效果;多种效果需建立明确的注册与 Section 对应关系。

参考资料

示例范围与许可

示例由 WESWOO 和注明的开源作者提供,复制代码时请保留相应许可。在线项目画面与摄影的权利归原权利人;下载文件使用占位图片,接入时请替换为有权使用的素材。

Shopify/dawn · modal / slider base classesShopify/dawn · product media galleryShopify/dawn · license

资料核对 · 2026-11-24