栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

除非单击鼠标,否则动态元素不会出现在IE8中

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

除非单击鼠标,否则动态元素不会出现在IE8中

不久之前,我在IE8上遇到了这个问题。

我认为这可能是IE8无法重新渲染有问题的元素的问题。一种简单的确认方法是将一个类添加到父元素,然后将其删除。这将触发IE8重新渲染元素。

如果contentBlock是父元素,则可以使用以下命令进行测试:

Javascript版本:

// Variable storing the test class namevar testClass = "testClass";// Add test class to elementcontentBlock.className += " "+testClass;// Remove test class from elementvar reg = new RegExp('(\s|^)'+testClass+'(\s|$)');contentBlock.className=contentBlock.className.replace(reg,' ');

jQuery版本:

// Variable storing the test class namevar testClass = "testClass";// Add test class to element and then remove it $('#divResults').addClass(testClass).removeClass(testClass);

在您添加appendChild之后,只需将其放在函数末尾即可。希望这可以解决您的问题。

参考:http :
//www.openjs.com/scripts/dom/class_manipulation.php



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/485271.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号