Bootstrap modal: close current, open new

前端 未结 27 1685
离开以前
离开以前 2020-11-29 00:23

I have looked for a while, but I can\'t find a solution for this. I want the following:

  • Open an URL inside a Bootstrap modal. I have this working off course. S
27条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 01:05

    Without seeing specific code, it's difficult to give you a precise answer. However, from the Bootstrap docs, you can hide the modal like this:

    $('#myModal').modal('hide')
    

    Then, show another modal once it's hidden:

    $('#myModal').on('hidden.bs.modal', function () {
      // Load up a new modal...
      $('#myModalNew').modal('show')
    })
    

    You're going to have to find a way to push the URL to the new modal window, but I'd assume that'd be trivial. Without seeing the code it's hard to give an example of that.

提交回复
热议问题