Bootstrap: Open Another Modal in Modal

后端 未结 21 1019
难免孤独
难免孤独 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:45

    Why not just change the content of the modal body?

        window.switchContent = function(myFile){
            $('.modal-body').load(myFile);
        };
    

    In the modal just put a link or a button

        
         click here to load another file
    

    If you just want to switch beetween 2 modals:

        window.switchModal = function(){
            $('#myModal-1').modal('hide');
            setTimeout(function(){ $('#myModal-2').modal(); }, 500);
            // the setTimeout avoid all problems with scrollbars
        };
    

    In the modal just put a link or a button

        
         click here to switch to the second modal
    

提交回复
热议问题