CSS - 在链接以外的元素上使用 :hover

发布于 2024-09-14 07:52:56 字数 743 浏览 5 评论 0原文

多年来,我的网站都有一个目录,其中小图像直接位于 div 内的链接内。链接必须仅位于图像周围 - 但我不想使用 + 选择器,因为某些版本的 IE 不支持此功能(我认为 IE6 及以上版本需要支持)。 div 具有类“ImageHoverSpan”(它曾经是旧布局上的 Span,我只是没有费心重命名该类)。还有另一个 div,其类为“ImageOuterPanel”,与链接位于同一级别(即 ImageHoverSpan 的直接子级)。

我定义了以下类:

  .ImageHoverSpan .ImageOuterPanel {
    display: none; }
  .customer .ImageHoverSpan:hover .ImageOuterPanel {
    display: block; }

据我所知,这在所有浏览器上都运行良好。我即将启动新版本的网站进行测试,但我今天刚刚注意到,在 Opera 10.60 中,图像面板 (ImageOuterPanel) 在将鼠标悬停在 ImageHoverSpan 上时立即显示,但需要 1 秒到 1 秒之间的时间。 ..当鼠标离开 div 时永远不会消失。

我知道在除链接之外的任何内容上使用 :hover 都会降低 IE 的性能 - 但这是 Opera。在 Firefox (3.6) 中,这工作得非常好 - 它会按其应有的方式出现和消失。

有谁对可能导致这种情况的原因有任何想法吗?以前有人遇到过这个问题吗?

谢谢。

问候,

理查德

For ages now my site has had a catalogue where the small image is directly within a link within a div. The link must only be around the image - but I do not want to use the + selector since this is not supported by some versions of IE (IE6 onwards I think it needs to support). The div has class "ImageHoverSpan" (it used to be a Span on an older layout, I just havent bothered renaming the class). There is another div, with class "ImageOuterPanel", on the same level as the link (i.e. a direct child of the ImageHoverSpan).

I have the following classes defined:

  .ImageHoverSpan .ImageOuterPanel {
    display: none; }
  .customer .ImageHoverSpan:hover .ImageOuterPanel {
    display: block; }

This certainly used to work fine as far as I can remember - on all browsers. I am about to launch the new version of the website into testing, but I just noticed today that, in Opera 10.60, the image panel (ImageOuterPanel) is displaying straight away on hover over the ImageHoverSpan, but it takes anything between 1 second and.. well.. never to disappear when the mouse leaves the div.

I know using :hover on anything other than links can slow performance in IE - but this is Opera. In Firefox (3.6) this works absolutely fine - it appears and disappears as it should.

Has anyone got any ideas about what could be causing this? Anyone had this problem before?

Thank you.

Regards,

Richard

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

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

发布评论

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

评论(1

姜生凉生 2024-09-21 07:52:56

好吧,我找到了答案。我在 Opera 论坛上提出了这个问题,一位用户回帖说我可以有一个 Opera 样式表,它可以保持元素可见,但将不透明度设置为 0 或 100。这是有效的 - 元素立即出现和消失。

理查德

Well I have found an answer. I asked the question on the Opera forums, and a user posted back that I could have an Opera stylesheet which keeps the elements visible but sets opacity to 0 or 100 instead. This works - the elements appear and disappear instantly.

Richard

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