简体   繁体   English

Internet Explorer闪烁问题

[英]Internet Explorer flickering issues

I'm building a web app that includes a running animation that reproduces the behavior of a non-portable marquee element. 我正在构建一个Web应用程序,其中包含一个运行动画,可以再现非便携式marquee元素的行为。 I'm using http://jscroller2.markusbordihn.de/ for that effect but the root cause of the problem does not seem directly related to the library itself (it's just the trigger that exposes the problem). 我正在使用http://jscroller2.markusbordihn.de/来解决这个问题,但问题的根本原因似乎与库本身没有直接关系(它只是暴露问题的触发器)。

The exact issue is as follows: 具体问题如下:

I have an html form with several input text fields which the user must fill. 我有一个html form ,其中包含用户必须填写的几个input文本字段。 The marquee animation is running every X milliseconds (where X is lower than 1 second). marquee动画每隔X毫秒运行一次(其中X小于1秒)。 Whenever a text field is focused (the user clicks on it with the intent of filling it out), the text cursor does not blink (as it should) and stays permanently in bar form (as a | sign - pardon my language... :-) ). 每当文本字段被聚焦时(用户点击它就意图填写它),文本光标不会闪烁(应该如此)并永久保持在条形图中(作为|符号 - 请原谅我的语言... :-))。

I have stripped down the offending code to the bare minimum and you can try it out here: http://jsfiddle.net/kyVqk/ . 我已经将违规代码删除到最低限度,你可以在这里试试: http//jsfiddle.net/kyVqk/

To test, just press the Start button and then click on text field. 要进行测试,只需按“ Start按钮,然后单击文本字段即可。 A dot should be appended to the label below the input text every time the animation runs and the cursor should not blink (that's the problem). 每次动画运行时,点应该附加到输入文本下面的标签上,光标不应该闪烁(这就是问题)。 Please note that if the animation runs in time intervals greater than 1 second, this does not happen (you can test this in the previous fiddle) and the cursor blinks as expected. 请注意,如果动画以大于1秒的时间间隔运行,则不会发生这种情况(您可以在之前的小提琴中测试)并且光标按预期闪烁。 This has led me to believe the problem lies in the way the browser performs the rendering of the text and unfocus/refocus the field during the update process. 这让我相信问题在于浏览器在更新过程中执行文本渲染和非聚焦/重新聚焦字段的方式。

This issue is specific to Internet Explorer (at least in version 6), as other major browsers (Firefox and Chrome) do not present this behavior. 此问题特定于Internet Explorer(至少在版本6中),因为其他主要浏览器(Firefox和Chrome)不会出现此行为。 I've tried updating the label through the DOM's object innerHTML directly but with no success. 我已经尝试直接通过DOM的对象innerHTML更新标签,但没有成功。 The exact content that's changed is of no importance either. 改变的确切内容也不重要。 If the animation only reads properties from the element, the issue does not present itself (only when updating the element's properties - any property). 如果动画仅从元素中读取属性,则问题不会出现(仅在更新元素的属性时 - 任何属性)。

Since the project I'm working on has high visibility and client exposure, the client is not willing to let that pass. 由于我正在开展的项目具有很高的知名度和客户曝光度,因此客户不愿意通过。 Can anybody shed some light on why this happens? 有人可以解释为什么会这样吗? Is there a workaround (attaching/detaching elements from the DOM before/after animation, refocusing after animation, etc.)? 是否有解决方法(在动画之前/之后附加/分离DOM中的元素,在动画之后重新聚焦等)? Please note that losing the marquee effect is not an option. 请注意,丢失marquee效果不是一种选择。

I got some flickering probs with IE in the past, don't know if it is the same as yours, but give it a try : 我过去曾经使用IE浏览过一些闪烁的问题,不知道它是否和你的一样,但试一试:

//@cc_on document.execCommand("BackgroundImageCache", false, true);// don't remove : prevent IE6 cursor blinking

Then another fix I remember is to set a fixed background to the body... 然后我记得的另一个修复是为身体设置一个固定的背景......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM