Skip to content

176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.

fix: Accordion: with several open at once, the posed answer stays open when another question is pressed

matine412aee87906
diff --git a/animations/04-micro-interactions/accordion/index.html b/animations/04-micro-interactions/accordion/index.html
index dba564a4..93f4412f 100644
--- a/animations/04-micro-interactions/accordion/index.html
+++ b/animations/04-micro-interactions/accordion/index.html
@@ -316,7 +316,9 @@
}
// Pressing a question, with the mouse, a finger or Enter and Space, and Show me both call this
function toggle(item){
+ const posed=posedItem;
lift(); // a posed box goes on from where it is, or closes by its own transition
+ if(multiOpen&&posed&&posed!==item)openItem(posed); // with several open it stays open, as an open answer would
const wasOpen=openSet.has(item);
if(!multiOpen)openSet.forEach(i=>{if(i!==item)closeItem(i)});
wasOpen?closeItem(item):openItem(item);