What Dynamic Adapt solves
In many cases, responsive design is not only about changing paddings or font sizes. Sometimes a block must appear in a totally different place in the markup on mobile: for example, moving a button into the header, placing a sidebar under content, or re-ordering cards for better UX.
How to use
Add the attribute data-anim-dynamic to the element you want to move.
JS is connected automatically when the attribute is present (you can use the da
snippet if you have it).
data-anim-dynamic="targetSelector, breakpoint, position, parentSelector"
- targetSelector — (required) selector of the container to move into.
- breakpoint — (required, default
767.98) screen width where move happens. - position — (default
0) index among existing children in the target container. - parentSelector — optional “scope” selector. If provided, the system searches for the target inside this parent.
767.98 as the breakpoint and
0 as the position.
Examples
Move a button into .header__actions on mobile:
<button
class="hero__cta"
data-anim-dynamic=".header__actions, 767.98, 0"
>
Get started
</button>
Move a sidebar under content at 991.98 and place it after the first
child:
<aside
class="layout__sidebar"
data-anim-dynamic=".layout__content, 991.98, 1"
>
...
</aside>
Use a parent selector to disambiguate the target (useful if the same selector appears multiple times on the page):
<div
class="card__meta"
data-anim-dynamic=".card__footer, 767.98, 0, .card"
>
...
</div>
Practical tips
Prefer stable selectors
Use unique, predictable selectors for targets (BEM-style containers are perfect).
Avoid selectors that might change (like :nth-child or deeply nested chains).
Think about accessibility
Moving elements changes DOM order, which affects keyboard navigation and screen readers. Make sure the new order still makes sense.
Use “position” intentionally
Position 0 means “first in target”.
If you need it after an existing block, use 1, 2, etc.
Download
Build responsive layouts faster: move blocks where they belong without rewriting markup for each breakpoint. Download the template and use Dynamic Adapt out of the box.