Bind the closing of a first modal to the opening of a second modal

陌路散爱 提交于 2019-12-08 05:10:02

问题


So when the first modal (this.$avatarModal) is closed, I would like a second modal (this.$modaldata) to open.:

The following sequence works however there are issues with the scrolling of the second modal not functioning:

    this.$avatarModal.modal('hide');
    this.$modaldata.modal('show'); 

As a solution to the scrolling issue, the dev on github are recommending to bind the event. However the following code, using .on does not work (the second modal does not open.

    this.$avatarModal.modal('hide');
    this.$avatarModal.on('hidden.bs.modal', function () {
      this.$modaldata.modal('show');
});

However, If i replace the show event with an alert, the alert opens:

    this.$avatarModal.modal("hide");
    this.$avatarModal.on('hidden.bs.modal', function () {
      window.alert('hidden event fired!');
});

This tells me that all the commands here are working, however having the 'show' method within the .on('hidden'... event does not seem to work.

Is there a reason for this incompatibility and how I can correctly open up the second modal after the first modal closes?

来源:https://stackoverflow.com/questions/27807225/bind-the-closing-of-a-first-modal-to-the-opening-of-a-second-modal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!