From 2eafc08c74f5f4aa803be9efbdb17ad585c86f7e Mon Sep 17 00:00:00 2001 From: Karlcarlo Date: Sat, 3 Oct 2026 07:11:45 +0000 Subject: [PATCH] =?UTF-8?q?=E5=A9=B4=E5=84=BF=E6=88=BF=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E8=A7=86=E5=B7=AE=EF=BC=88=E6=92=A4=E5=9B=9E?= =?UTF-8?q?=20v26100210=EF=BC=89(v26100211)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- index.html | 2 +- js/app.js | 20 +++++++++++++++++--- mama-box.css | 3 --- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 8a38e63..fe5d3b5 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ 兜爸心选 · 孕育陪伴 - + diff --git a/js/app.js b/js/app.js index ba968ee..cac4ff3 100644 --- a/js/app.js +++ b/js/app.js @@ -3,7 +3,7 @@ (function () { 'use strict'; /* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */ - var VER = '26100210'; + var VER = '26100211'; const $ = (s, c) => (c || document).querySelector(s); const $$ = (s, c) => Array.from((c || document).querySelectorAll(s)); @@ -3236,8 +3236,22 @@ /* 2026-10-02 整块可点(按钮的点击冒泡上来,同一个入口) */ sec.addEventListener('click', () => jumpApp(NURSERY_URL + '?return_url=' + encodeURIComponent(location.origin + location.pathname), NURSERY_ID)); - /* 2026-10-03 去掉视差:原来每帧按 .screen 滚动位置写 transform,微信里 JS 滚动事件比页面滚动慢一拍, - 滑过这块时房子跟着抖。现在图层就是块内静态图,跟页面一起滚(样式见 mama-box.css 同日注释)。 */ + /* 视差:图层始终对齐 .screen 的可视区 → 页面滚、房间不动,像铺在整页背后 */ + const layer = $('#nypLayer'), scr = sec.closest('.screen'); + let raf = 0; + const place = () => { + raf = 0; + if (!scr) return; + const s = scr.getBoundingClientRect(), r = sec.getBoundingClientRect(); + if (!s.height || !r.height) return; + layer.style.height = s.height + 'px'; + layer.style.transform = 'translate3d(0,' + Math.round(s.top - r.top) + 'px,0)'; + }; + const req = () => { if (!raf) raf = requestAnimationFrame(place); }; + if (scr) scr.addEventListener('scroll', req, { passive: true }); + window.addEventListener('resize', req); + if ('IntersectionObserver' in window) new IntersectionObserver(req).observe(sec); + place(); /* 封面版本:3D 婴儿房会话换图(文件名不变)时改这里,强制微信 webview 重新拉图 */ const NY_COVER_V = '20261001p'; const tick = () => { diff --git a/mama-box.css b/mama-box.css index 16defd4..eaa40ab 100644 --- a/mama-box.css +++ b/mama-box.css @@ -4274,6 +4274,3 @@ a.skip:focus{left:16px;top:16px} .ny-peek.is-night .nyp-btn{background:linear-gradient(135deg,#9AD69A,#62B474);box-shadow:0 4px 12px rgba(0,0,0,.3)} /* 同日:左上角「进去看看」角标也跟按钮统一成青草绿 */ .nyp-chip{color:#3F8F52;box-shadow:0 2px 8px rgba(70,152,90,.18)} -/* 2026-10-03:婴儿房去掉视差(滑动时会颤),图层固定铺满这一块、跟页面一起滚; - 取景对齐原来「这块滑到屏幕正中」时的画面 */ -.nyp-layer{height:100%;transform:none;will-change:auto}