动画 gif 导致 IE 中的输入闪烁

发布于 2024-07-22 19:28:01 字数 1052 浏览 9 评论 0原文

当页面上有动画 gif 时,输入中的光标会随着 IE7 闪烁。

去掉gif,问题就消失了。

编辑(再次): 我真正需要的是知道奇怪的 ie bug 答案的人。

我是一名拥有 10 年经验的网络应用开发人员。 相信我,我知道如何调试——例如,知道动画 gif 是屏幕绘制的原因是成功调试的结果。 解决这个问题是另一回事。

使用我的 gif 和下面答案三中的代码进行编辑(再次,再次)。

<html>
    <head>
        <style type="text/css">
            #img {
                position: absolute;
            }
            #dv {
                background-color: transparent;
                border: 1px solid Black;
                height: 450px;
                position: absolute;
                width: 600px;
            }
            #frm {
                left: 170px;
                position: absolute;
                top: 100px;
            }
        </style>
    </head>
    <body>
        <img src="http://www.johnherr.net/skeleton.gif" id="img">
        <div id="dv">
        </div>
        <form id="frm">
            <input type="text">
        </form>
    </body>
</html>

The Cursor in an input flickers with IE7 when the page has an animated gif on it.

Take away the gif, and the problem goes away.

Edit (again):
What I really need is somebody who knows the answer to a bizarre ie bug.

I'm a 10 year experienced web app developer. Trust me, I know how to debug -- for instance, knowing for a fact that the animated gif is the reason for the screen draw is the result of a successful debug. Fixing that is another matter.

Edit (again, again), using my gif, and the code from answer three below.

<html>
    <head>
        <style type="text/css">
            #img {
                position: absolute;
            }
            #dv {
                background-color: transparent;
                border: 1px solid Black;
                height: 450px;
                position: absolute;
                width: 600px;
            }
            #frm {
                left: 170px;
                position: absolute;
                top: 100px;
            }
        </style>
    </head>
    <body>
        <img src="http://www.johnherr.net/skeleton.gif" id="img">
        <div id="dv">
        </div>
        <form id="frm">
            <input type="text">
        </form>
    </body>
</html>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

眼趣 2024-07-29 19:28:01

我遇到过同样的问题。 删除 gif 动画,闪烁就会停止。

查看 CSS,我注意到图像正在调整大小以供显示。

我使用在线编辑器创建了我需要的大小的图像副本。

将动画 gif 切换到不需要调整大小的版本解决了问题。

I had the same issue. Remove the animated gif and the flicker stops.

Looking at the CSS, I noticed that the image was being resized for display.

I created a copy of the image using an online editor to the size that I needed.

Switching the animated gif to a version not requiring resizing solved the problem.

樱花细雨 2024-07-29 19:28:01

也许是你的CPU无法处理负载? 这尤其可能是在运行密集型 JavaScript 的网站上的旧计算机上引起的。

Perhaps it's your CPU that can't handle the load? This could especially be caused on an older machine on a website running intensive javascript.

自由范儿 2024-07-29 19:28:01

只要说我们有一个
gif 动画绝对定位。 它
约为 600 x 400。它位于下方
另一个腹肌。 定位 div 其中
提供透明层。 最后
形式本身就是abs。 定位
在此之上。

<style type="text/css">
#img {
    position: absolute;
}
#dv {
    background-color: transparent;
    border: 1px solid Black;
    height: 450px;
    position: absolute;
    width: 600px;
}
#frm {
    left: 170px;
    position: absolute;
    top: 100px;
}
</style>
<img src="http://vulcan.wr.usgs.gov/Imgs/Video/MSH/MSH06/MSH06_MOVIE_before_after_from_brutus_10-21_and_10-22-06_animated.gif" id="img">
<div id="dv">
</div>
<form id="frm">
<input type="text">
</form>

我试图尽可能地复制你所描述的内容。 我将上述内容加载到 IE 6、7 和 8 中,但没有看到任何闪烁的光标问题。

鉴于我可以提出一个不存在该问题的实现,因此 IE 7 中似乎不存在任何一般的 animated-gif-causes-input-cursor-flickering 错误,并且您的特定的标记和 CSS 暴露了该浏览器中的问题。

拿走gif,问题就来了
消失。

众所周知,动画
gif是屏幕绘制的原因
是成功调试的结果。

当然,添加动画 gif 是导致您所看到的内容的最后一块拼图。 但正如我所演示的,您可以在绝对定位的动画 gif 上放置一个绝对定位的表单,并在它们之间有一个透明的 div,并且光标不会闪烁。

我认为你必须一次一层地剥离你正在做的事情,直到你能具体确定你的标记或CSS中暴露问题的是什么。

还有另一种可能性,您看到的闪烁可能是您的视频卡和/或视频驱动程序的伪影。 您可能需要尝试在硬件完全不同的机器上在 IE 7 下查看页面,以排除这种可能性。

Suffice it to say that we have an
animated gif absolutely positioned. it
is ~ 600 x 400. it sits beneath
another abs. positioned div which
provides a transparency layer. Finally
the form itself is abs. positioned
over that.

<style type="text/css">
#img {
    position: absolute;
}
#dv {
    background-color: transparent;
    border: 1px solid Black;
    height: 450px;
    position: absolute;
    width: 600px;
}
#frm {
    left: 170px;
    position: absolute;
    top: 100px;
}
</style>
<img src="http://vulcan.wr.usgs.gov/Imgs/Video/MSH/MSH06/MSH06_MOVIE_before_after_from_brutus_10-21_and_10-22-06_animated.gif" id="img">
<div id="dv">
</div>
<form id="frm">
<input type="text">
</form>

I tried to replicate what you described as closely as possible. I loaded the above into IE 6, 7 and 8 and was unable to see any flickering cursor problems.

Given that I can come up with an implementation that does not exhibit the issue, there does not seem to be any general animated-gif-causes-input-cursor-flickering bug in IE 7 and something in your specific markup and CSS is exposing the problem in that browser.

Take away the gif, and the problem
goes away.

knowing for a fact that the animated
gif is the reason for the screen draw
is the result of a successful debug.

Certainly adding the animated gif is the final piece of the puzzle leading to what you are seeing. But as I've demonstrated, you can have an absolutely positioned form over an absolutely positioned animated gif with a transparent div between them and the cursor does not flicker.

I think you are going to have to strip away what you are doing one layer at a time until you can determine specifically what it is in your markup or CSS that exposes the problem.

There is one other possibility, the flickering you are seeing may be an artifact of your video card and/or video driver. You might want to try viewing the page under IE 7 on a machine with completely different hardware to rule out this possibility.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文