IE8 和 IE9 选择框悬停时会自行关闭

发布于 2024-10-29 15:57:47 字数 243 浏览 1 评论 0原文

我遇到了这个奇怪的问题,如主题所示:在 IE 中(我正在测试版本 8,无法测试较旧/较新的版本),并且仅在 IE 中,当我将鼠标悬停在我的网站上时,我网站上的所有选择框都开始自行关闭鼠标选择一个选项。 这不会发生在 Firefox 上,也不会发生在我的本地服务器上,仅发生在测试远程服务器上(是的,这两个站点是相同的)。 所以,回顾一下: 本地版本:一切都很好,即使在 IE 中也是如此。 远程版本:当我将鼠标悬停在 IE 的选择框上时,它们就会“崩溃”。 有什么想法吗?

I got this weird problem as in topic: in IE (i'm testing version 8, got no way to test older/newer versions) and only in IE all the select boxes on my website started to close themselves as soon as i hover my mouse to select an option.
This isn't happening on Firefox, and this isn't happening on my local server, only on the test remote server (yes, the two sites are identical).
So, to recap it:
Local version: all fine, even in IE.
Remote version: IE's select boxes "crash" as soon as i hover on them.
Any ideas?

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

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

发布评论

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

评论(8

自在安然 2024-11-05 15:57:47

我仅在 IE8 中遇到此问题,解决方法如下:

在 CSS 中,我将字体系列应用于 SELECT
相反,我将其应用于SELECT OPTION

因此,我没有这样做:

select {font-family:'Avenir LT W01 85 Heavy';}

我这样做了:

select option {font-family:'Avenir LT W01 85 Heavy';}

菜单停止不规则地关闭。希望这对某人有帮助。

I had this problem in IE8 only and here's how I solved it:

In my CSS I was applying a font-family to the SELECT.
Instead I applied it to the SELECT OPTION.

So instead of this:

select {font-family:'Avenir LT W01 85 Heavy';}

I did this:

select option {font-family:'Avenir LT W01 85 Heavy';}

And the menu stopped closing erratically. Hope this helps someone.

转瞬即逝 2024-11-05 15:57:47

我发现问题在于在字体系列的名称中添加引号。
写,而是声明了

select{font-family:"Open sans";}

所以,我没有

select{font-family: open sans;}

I found that the problem was in adding quotes in the name of the font-family.
So, instead of writing

select{font-family:"Open sans";}

i've declared

select{font-family: open sans;}
错爱 2024-11-05 15:57:47

我也有同样的问题。就我而言,它与 Javascript 完全无关,与您的链接所暗示的相反。原来是简单的CSS。

最终我发现,将 color 属性应用到我的 select 输入的 CSS 中,使用黑色以外的任何内容都会导致它们无法使用。该值是十六进制还是 RGB 并不重要,只要它是黑色即可。

我将条件注释添加到目标 IE 7 或 8(即使 7 很好,但我需要它用于兼容模式下的 IE 8),并设置此样式声明:

.myclass select {
   color: #000;
}

I was having the same issue. In my case it was totally unrelated to Javascript, contrary to what your link implies. Turned out to be simple CSS.

Eventually I discovered that applying a color attribute to my select inputs' CSS with anything other than black would render them unusable. It didn't matter if the value was in hex or rgb, as long as it was black.

I put a conditional comment to target IE 7 or 8 (even though 7 was fine, I need it for IE 8 in compatibility mode), and set up this style declaration:

.myclass select {
   color: #000;
}
燃情 2024-11-05 15:57:47

我遇到了同样的问题,解决方案如下:

select         { font-family:inherit; font-size:inherit; }

select 的父级有必要的字体选项。

感谢您的回答这个问题

I've got the same problem and the solution is following:

select         { font-family:inherit; font-size:inherit; }

and the parent of select has necessary font option.

Thank for this answer this question

恋竹姑娘 2024-11-05 15:57:47

看起来可能是一些不同的 CSS 声明导致了这种情况。

我遇到了同样的问题,但没有颜色声明。事实证明这是字体系列规则。我使用条件注释来定位 IE8 及更早版本,并将字体系列设置为“继承”。填充效果很好,字体大小也很好。

It looks like it might be a few different CSS declarations that can cause this.

I was having the same problem but no color declaration. It turns out that it was a font-family rule. I used a conditional comment to target IE8 and older and set the font-family to "inherit." Padding works fine, as does font-size.

辞别 2024-11-05 15:57:47

我花了一整天的时间研究这个问题,但是是在 IE9 中。我正在分享我的解决方案,因为它不是由于 selectcolorfont-family 引起的。

事实证明,当 IE 在 select 中发现一个 option 具有指定的 opacity CSS 值时,它会崩溃。即使不透明度被另一个具有 opacity: noneopacity: 1 的 CSS 规则覆盖,该属性甚至不应该出现。

这是一个令人毛骨悚然的浏览器错误。

I spent a whole day investigating this issue but in IE9. I'm sharing my solution since it wasn't because of the color or font-family of the select.

It turns out that IE freaks out when it finds an option inside a select that has a specified CSS value for opacity. The issue happens even if the opacity is overridden by another CSS rule with opacity: none or opacity: 1, the property shouldn't even appear.

It's a creepy browser bug.

一袭白衣梦中忆 2024-11-05 15:57:47

我在IE9下也遇到过这个问题。这是由于 @font-face 语句,其中 font-family 属性等于真实的 font-family 名称。在 IE11 中运行良好。

I've had this issue in IE9 also. It was due to @font-face statements where you have the font-family property equal to the real font-family name. In IE11 it works fine.

靑春怀旧 2024-11-05 15:57:47

那救了我:

$('select').css('background-color','red')

PS。即使背景颜色已经在 css 文件中设置,也需要重置背景颜色。

That saved me:

$('select').css('background-color','red')

PS. Need to reset background color even if it's already set in css file.

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