O
O
ololodff2022-01-11 22:44:43
JavaScript
ololodff, 2022-01-11 22:44:43

How to close collapse in bootstrap 5 on click?

There is a regular collapse (I have it coming out from below). It overlays my modal window, and therefore I want to hide collapse first before opening the window.
How to properly use closure methods in new bootstrap 5?

$("#auth").on("click", function () {
    $('#offcanvasBottom').hide();
    Fancybox.show([{ 
        dragToClose: false,
        src: "#authmodal", 
        type: "inline",
    }]);
});

Не срабатывает. И да, у меня подключен jquery..

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Sharomet, 2022-01-11
@ololodff

This is offcanvas, not collapse

$("#auth").on("click", function () {
  ... 
  let myOffcanvas = document.getElementById('offcanvasBottom'); //jquery - $('#offcanvasBottom')[0]
  let bsOffcanvas = new bootstrap.Offcanvas(myOffcanvas);
  bsOffcanvas.hide();
  ... 
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question