Me gustaría saber si hay alguna forma de detectar cuando el carrusel de Bootstrap termina de ejecutarse, ya que necesito ejecutar una función cuando el carrusel llega al último elemento.
Aplico aquí la pregunta a un comentario para verlo en mejor formato:
const carousel = document.getElementById("carouselContainer"); carousel.addEventListener("slid.bs.carousel", function (e) { if (e.direction === "right" && e.to === elements.length - 1) { // Take an action } });Sí, verifique la documentación : debe comparar from y to según la direction .
if (direction == 'left' && to == 0) { startReached(); } if (direction == 'right' && to == elements.length - 1) { endReached(); }