gpt4 book ai didi

jQuery 和 IE 在 $ ('#someDiv' ).hide(); 上崩溃

转载 作者:行者123 更新时间:2023-12-03 22:27:42 25 4
gpt4 key购买 nike

好吧,经过一段时间的挠头并“嗯?”试图找出为什么 IE 在加载我的一个加载了 jQuery 的页面时会直接崩溃,我将罪魁祸首的范围缩小到了这一行

$('div#questions').hide();

当我说 IE 崩溃时,我的意思是它完全崩溃了,试图进行网页恢复,但失败了。

我正在运行 jQuery 1.4.2 并使用 IE 8(尚未使用任何其他版本进行测试)

我当前的解决方法是这样的:

if ($.browser.msie) { 
window.location = "http://www.mozilla.com/en-US/products/download.html";
}

出于某种原因,我觉得我的 IE 用户不会对此解决方案感到非常满意。

有问题的 div 中有很多内容,其他 div 被隐藏并再次显示,所有这些都工作得很好,只有当巨大的父 div 被隐藏时 IE 才会翻转并刺伤本身。

有没有人遇到过这种情况或者对出了什么问题有任何可能的想法?

编辑:

所有内容都包含在 $(document).ready(function() { }); 中而且我的代码都是内部的,所以不幸的是我无法链接它。

编辑:发现 IE 8 崩溃代码

<ol class="actionHelp">
<li>List the tasks (or actions) that are involved in your pattern along the top (one per column)</li>
<li>Put the starting point in the first column and the ending point in the last column.</li>
<li>To fill in the middle, simply ask: "What happens next?" If only one thing ever happens next, then it should get 100%. If 70% of the time one thing happens next, and 30% of the time another thing happens next, then put 70 in one box and 30 in the other.</li>
<li>Each row should add up to 100%</li>
<li>The last row is the exit and should not have any percentages in it.</li>
</ol>

我不知道为什么这会在 IE 中引起问题,但这是 CSS

.actionHelp {
margin: 0 0 0 20px;
}
.actionHelp li {
margin: 5px 0;
}

使用无序列表而不是有序列表不会导致崩溃,但是一旦我将其切换回来,我就会再次崩溃,这个元素不需要排序,我只是将其作为逻辑步骤从某种意义上说,我仍然想知道为什么这会让 IE 感到害怕。

jQuery + IE + 隐藏 ol 元素 = OMG IE FAIL 吗?或者有解决办法吗?

它似乎会影响任何具有除无之外的列表样式的列表元素

最佳答案

您的问题显然不是 div#questions 本身。您能否尝试删除(或注释掉)div#questions 的所有内容,然后一次添加一个元素,直到 IE 再次开始崩溃?

找到罪魁祸首后,请对该元素再次执行相同的操作,删除其所有内容并将每个元素添加回来,并在每个元素之后进行测试。

继续这样做,直到找到问题的真正根源。我知道这是一种技术含量很低的解决方案,但通常也是最快的解决方案。

关于jQuery 和 IE 在 $ ('#someDiv' ).hide(); 上崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2567398/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com