1// Hide current modal before opening new one
2$("#idModal").modal('hide');
3$("#idModal2").modal() // or .modal("show");
4
5// show 1st modal again after closing 2nd modal
6$("#idModal2").on('hidden.bs.modal', () => $("#idModal").modal('show'))
7// using hide.bs.modal might cause modal to stop scrolling!!!