rez2o_
rez2o_
SSolidJS
Created by rez2o_ on 8/23/2024 in #support
how to update the DOM styles in a time sequence when a single signal changes?
I want a group of div elements to appear one by one. I tried to do this, it seems that createEffect only updates once?
// ...
const [signal, setSignal] = createSignal(false);
let refDiv1, refDiv2;
createEffect(async ()=> {
if(signal()) {
refDiv1.style.display='block';
await new Promise(resolve => setTimeout(resolve, 1000));
refDiv2.style.display='block';
await new Promise(resolve => setTimeout(resolve, 1000));
// ...
}
})
// ...
const [signal, setSignal] = createSignal(false);
let refDiv1, refDiv2;
createEffect(async ()=> {
if(signal()) {
refDiv1.style.display='block';
await new Promise(resolve => setTimeout(resolve, 1000));
refDiv2.style.display='block';
await new Promise(resolve => setTimeout(resolve, 1000));
// ...
}
})
9 replies