Accordion

The Qwwwik 'accordion' feature was updated from the previous one on 11th September 2024. This is better. To update, update the styles and upload '/js/accordion-tab.js'. The new HTML markup is below:

Accordion item 1

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.

Accordion item 2

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.

Accordion item 3

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.

Add as many items (or as few) as required.


The HTML markup:
<div class="accordion">

<div class="tab"><div>Accordion item 1</div></div>

<div class="panel">

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam (more text ...)

</div>

<div class="tab"><div>Accordion item 2</div></div>

<div class="panel">

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam (more text ...)

</div>

<div class="tab"><div>Accordion item 3</div></div>

<div class="panel">

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam (more text ...)

</div>

</div>

The styles for the previous version can be added to 'extra.css':

.accordion { width: 100%;
  margin: 1.8em auto 1.2em auto;
}

details {
  margin: 0 0 0.6em 0;
}

details p {
  padding-top: 0.25em;
  padding-bottom: 0.35em;
}

summary { /* The visible boxes */
  margin: 0.6em 0 0.6em 0;
  padding: 0.8em 19px 0.75em 30px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-family: inherit;
  font-weight: 400;
  color: #666;
  background: var(--white);
  cursor: pointer;
  position: relative;
  transition: .3s;
}

summary:hover {
  color: var(--link);
  background: #f9f9f9;
}

summary::marker {
  content: "";
}

summary::before {
  content:"";
  position: absolute;
  inset: .75rem;
  left: auto;
  aspect-ratio: 1;
  background: conic-gradient(from 90deg at 26% 26%, #0000 90deg, #ddd 0) 100% 100%/58% 58%; /* Rotating symbol */
  clip-path: inset(1px);
  transition: .3s;
}

details[open] summary::before {
  transform: rotate(45deg);
}

details[open] summary {
  border-radius: 5px;
  background: #fff; /* Background when open */
}

The JavaScript file for the previous version is '/js/accordion.js'.

See information

Page last modified: 13 September, 2024
Search | Legal | Qwwwik

Info