parent
ce3754f030
commit
44c4ffe3c2
|
|
@ -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){
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue