Skip to content

Commit

Permalink
* prevent dismiss modal in modal.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed Jul 3, 2018
1 parent d4fbc60 commit 1a030d6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/js/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@

that.escape()

that.$element.on('click.dismiss.' + zuiname, '[data-dismiss="modal"]', $.proxy(that.hide, that))
that.$element.on('click.dismiss.' + zuiname, '[data-dismiss="modal"]',function(e) {
that.hide();
e.stopPropagation();
})

that.backdrop(function() {
var transition = $.support.transition && that.$element.hasClass('fade')
Expand Down

1 comment on commit 1a030d6

@jiaminghai
Copy link

@jiaminghai jiaminghai commented on 1a030d6 Apr 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个调整了影响某些写法的使用,这个是出于啥原因调整了呢?
我看1.8.1的官方编译包这个还是原来的处理逻辑,到了1.9.1就改变了。
最新bootstrap官方的modal在这里的处理逻辑还是和原来一致的。

原来的处理逻辑在当前显示状态的modal body这么写一个锚点超链接点击后可以实现隐藏当前modal,显示另外一个modal,类似下面这样子。
<a href="#testModal" data-toggle="modal" data-dismiss="modal">测试</a>

现在不行哈。
e.stopPropagation();这里终止派发了。

Please sign in to comment.