Answer by dkasa for How to trigger a patch event with inline HTMX tags when a Bootstrap 5 carousel-i
After going back to this problem I ended up finding a solution that works.
<div id="project-carousel" class="carousel slide" data-bs-ride="carousel">
...
<div class="carousel-inner">
<div id="6ec3f558-8526-4a3f-b70a-aeacf052805b"
hx-patch="/projects/6ec3f558-8526-4a3f-b70a-aeacf052805b/"
hx-trigger="slid.bs.carousel[to == 1] from:#project-carousel once"
hx-swap="none">
<a href="/projects/6ec3f558-8526-4a3f-b70a-aeacf052805b/">
<div class="carousel-item active">
</div>
</a>
</div>
<div id="f2b061f3-3ccc-42aa-8217-c1194cdf4f00"
hx-patch="/projects/f2b061f3-3ccc-42aa-8217-c1194cdf4f00/"
hx-trigger="slid.bs.carousel[to == 2] from:#project-carousel once"
hx-swap="none">
<a href="/projects/f2b061f3-3ccc-42aa-8217-c1194cdf4f00/">
<div class="carousel-item">
</div>
</a>
</div>
</div>
...
</div>
The key was to listen to the proper element as slid.bs.carousel
was called from outer carousel class and after that you just have to filter for the to
parameter from the event.