Как использовать события слайдера bootstrap 4?

Читаю документацию bootstrap 4 https://getbootstrap.com/docs/4.1/components/carou...

Events
Bootstrap’s carousel class exposes two events for hooking into carousel functionality. Both events have the following additional properties:

direction: The direction in which the carousel is sliding (either "left" or "right").
relatedTarget: The DOM element that is being slid into place as the active item.
from: The index of the current item
to: The index of the next item

Event Type Description
slide.bs.carousel This event fires immediately when the slide instance method is invoked.
slid.bs.carousel This event is fired when the carousel has completed its slide transition.


Не пойму как внутри:
$('#myCarousel').on('slide.bs.carousel', function () {
  // do something…
})

Использовать параметры [from] и [to].
  • Вопрос задан
  • 169 просмотров
Решения вопроса 1
PbI6A_KuT
@PbI6A_KuT Автор вопроса
Нашел. Вот так:

$('#myCarousel').on('slide.bs.carousel', function (e) {    
    console.log(e.from, e.to);
    
    if( e.from > e.to ) {
    } else {
    }
  });


Кто объяснит что это за "e"?
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы