Twitter引导多个模态错误 [英] Twitter bootstrap multiple modal error

查看:145
本文介绍了Twitter引导多个模态错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在另一个模态中使用模态。但是,我在firefox中收到了太多递归的错误。

I try to have a modal inside another modal. However, I got an error like "too much recursion" in firefox.

我使用了最新的jQuery和Twitterbootstrap,但仍然存在这个问题。

I used the latest jQuery and Twitterbootstrap but still have this problem.

以下是显示错误的 plunker

您可以在控制台中找到Uncaught RangeError:超出最大调用堆栈大小或过多递归

You can find "Uncaught RangeError: Maximum call stack size exceeded" or "too much recursion"

错误

任何人都知道如何修复它?谢谢

Anyone knows how to fix it ? Thanks

推荐答案

好的,这似乎是一个已被发现的问题。

Ok, it seems like an issue that has been discovered.

(显然我应该使用关键词Uncaught RangeError:超出最大调用堆栈大小而不是过多的递归:()

(apparently I should use key word "Uncaught RangeError: Maximum call stack size exceeded" instead of "too much recursion" :( )

以下是解决方案。

1.修改modal.js

在这篇文章中, https://github.com/twbs/bootstrap/pull/5022

@onassar提出解决方案

@onassar bring up a solution


跟进:对于任何使用bootstrap-modal v2.2.0的人,在
enforceFocus方法中,注释掉。$ element.focus()似乎解决了
问题。

Follow up: for anyone working with bootstrap-modal v2.2.0, in the enforceFocus method, commenting out that.$element.focus() seems to fix the issue.

结果是模态的重点不在于(pfft,我可以自己做b $ b):因此,多个模态不会为焦点挑战
一个另一个(导致无限循环)和
rangerror / recursive loop)。

The result of this is the modal's don't get focused upon (pfft, I can do that myself :P), and thus, the multiple modals don't challenge one-another for focus (which resulted in an infinite loop, and a rangerror/recursive loop).

希望有帮助:)

我试过,它的工作原理。 ( plunker

I tried and it works. (plunker)

2。使用另一个插件来解决此问题 演示

看起来效果非常好。

3。等待官方解决方案。

在他们的路线图,他们确实希望在某些时候重写这个模态插件。

In their roadmap, they do want to rewrite this modal plugin at some point.

这篇关于Twitter引导多个模态错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆