Search code examples
javascriptbootstrap-tour

Exit bootstrap tour on modal close


I'm using Bootstrap Tour to display help steps on a modal. My problem is that when the modal is closed or dismissed (by clicking outside the modal) the tour popup lingers and none of the buttons work (end tour, prev, next).

How can I exit the tour when the modal is closed?


Solution

  • When using Bootstrap 3 modals you can bind js to the cancel/exit event like this:

    $('#modal').on('hidden.bs.modal', function () {
        tour.exit();
    });
    

    You could also jump to a previous tour step, if there are any before the modal.