I created a Bootstrap plugin that incorporates a lot of the ideas posted here.
Demo on Bootply: http://www.bootply.com/cObcYInvpq
Github: https://github.com/jhaygt/bootstrap-multimodal
It also addresses the issue with successive modals causing the backdrop to become darker and darker. This ensures that only one backdrop is visible at any given time:
if(modalIndex > 0)
$('.modal-backdrop').not(':first').addClass('hidden');
The z-index of the visible backdrop is updated on both the show.bs.modal
and hidden.bs.modal
events:
$('.modal-backdrop:first').css('z-index', MultiModal.BASE_ZINDEX + (modalIndex * 20));