Bootstrap: Open Another Modal in Modal

后端 未结 21 926
难免孤独
难免孤独 2020-11-27 11:28

So, I\'m using this code to open another modal window in a current opened modal window:



        
21条回答
  •  自闭症患者
    2020-11-27 11:42

    I also had some trouble with my scrollable modals, so I did something like this:

      $('.modal').on('shown.bs.modal', function () {
        $('body').addClass('modal-open');
        // BS adds some padding-right to acomodate the scrollbar at right
        $('body').removeAttr('style');
      })
    
      $(".modal [data-toggle='modal']").click(function(){
        $(this).closest(".modal").modal('hide');
      });
    

    It will serve for any modal whithin a modal that comes to appear. Note that the first its closed so the second can appear. No changes in the Bootstrap structure.

提交回复
热议问题