fix(posimai-sc): 理解度チェックへのジャンプ位置ズレを修正

Made-with: Cursor
This commit is contained in:
posimai 2026-04-20 18:43:38 +09:00
parent ce3754f030
commit 44c4ffe3c2
1 changed files with 15 additions and 4 deletions

View File

@ -827,17 +827,28 @@ document.addEventListener('alpine:init', () => {
this.stepMode=false; this.stepMode=false;
this.$nextTick(()=>{ this.$nextTick(()=>{
if(window.lucide) lucide.createIcons(); if(window.lucide) lucide.createIcons();
const el=document.getElementById('comprehension-quiz'); requestAnimationFrame(()=>{
if(el) el.scrollIntoView({behavior:'smooth',block:'start'}); requestAnimationFrame(()=>{ this.scrollMainToComprehension(); });
});
}); });
}, },
scrollToComprehension(){ scrollToComprehension(){
this.$nextTick(()=>{ this.$nextTick(()=>{
const el=document.getElementById('comprehension-quiz'); requestAnimationFrame(()=>{
if(el) el.scrollIntoView({behavior:'smooth',block:'start'}); requestAnimationFrame(()=>{ this.scrollMainToComprehension(); });
});
if(window.lucide) lucide.createIcons(); if(window.lucide) lucide.createIcons();
}); });
}, },
scrollMainToComprehension(){
const m=document.getElementById('main');
const el=document.getElementById('comprehension-quiz');
if(!m||!el) return;
// main内の実座標で算出して、カード先頭へ安定して合わせる
const offset=8;
const top=(el.getBoundingClientRect().top - m.getBoundingClientRect().top) + m.scrollTop - offset;
m.scrollTo({ top:Math.max(0,top), behavior:'smooth' });
},
stepGoBack(){ stepGoBack(){
if(!this.stepMode) return; if(!this.stepMode) return;
if(this.stepStep===1){ if(this.stepStep===1){