检查是否支持悬停在非< a>上分子 [英] Check for support for hover on non <a> elements

查看:77
本文介绍了检查是否支持悬停在非< a>上分子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!


问题我开始:Netscape / Opera支持悬停不同的元素,

IE仅支持悬停< a>我想使用hover for< td class =" menu">


然后我在这里找到了使用一些Javascript的修复:
http://webpages.charter.net/mmmbeer/...bitrary-hover/


它现在适用于IE浏览器。


问题我现在有:我不希望脚本运行在浏览器

支持悬停< td> ;.


换句话说,我注意到脚本仍然在运行Netscape和

Opera - 但我更愿意让这些浏览器的本机悬停支持

起作用,因为我注意到在某些情况下脚本会引入延迟

加载时间。


我不想嗅闻IE:我知道浏览器嗅探是多么不可靠。我会因为缺乏悬停支持而嗤之以鼻。


谁能给我一些关于如何做到这一点的线索?


任何帮助都会非常感激!


Rob

:)

Hi All!

Problem I began with: Netscape/Opera supports hover for different elements,
IE only supports hover for <a> and I want to use hover for <td class="menu">

I then found a fix using some Javascript here:
http://webpages.charter.net/mmmbeer/...bitrary-hover/

It works ok for IE now.

Problem I now have: I don''t want the script to run in a browser that does
support hover for <td>.

In other words I noticed that the script was still running for Netscape and
Opera - but I would prefer to let those browser''s native hover support to
work since I notice that in some cases the script can introduce lag at
loading time.

I don''t want to sniff for IE: I know how unreliable browser sniffing is. I
would rather sniff for the lack of hover support.

Can anyone give me clues as to how this might be done?

Any help would be most appreciated!

Rob
:)

推荐答案

On Tue,2004年7月27日10:32:30 +1000,Robert Mark Bram< none>声明在

comp.lang.javascript,alt.html:
On Tue, 27 Jul 2004 10:32:30 +1000, Robert Mark Bram <none> declared in
comp.lang.javascript,alt.html:
我不想嗅闻IE:我知道浏览器嗅探是多么不可靠。我宁愿因缺乏悬停支持而嗤之以鼻。
I don''t want to sniff for IE: I know how unreliable browser sniffing is. I
would rather sniff for the lack of hover support.




你可以使用条件评论。这是一种浏览器嗅探,但

它是可靠的。
http://msdn.microsoft.com/workshop/a...omment_ovw.asp


- -

Mark Parnell
http://www.clarkecomputers .com.au

在阅读usenet时不要喝朗姆酒和焦炭 - rf 2004



You could use conditional comments. It''s kind of browser sniffing, but
it is reliable.
http://msdn.microsoft.com/workshop/a...omment_ovw.asp

--
Mark Parnell
http://www.clarkecomputers.com.au
"Never drink rum&coke whilst reading usenet" - rf 2004


嗨Mark,


感谢您的回复!
Hi Mark,

Thanks for the reply!
我不想嗅闻IE:我知道浏览器嗅探是多么不可靠。
我宁愿因缺乏悬停支持而嗤之以鼻。
I don''t want to sniff for IE: I know how unreliable browser sniffing is. I would rather sniff for the lack of hover support.



你可以使用条件评论。这是一种浏览器嗅探,但它是可靠的。
http://msdn.microsoft.com/workshop/a...omment_ovw.asp




嗯,这似乎工作正常:


<! - [如果IE 5]>

< script language =" javascript" type =" text / javascript"

src =" ../ bin / ieHoverFix.js">< / script>

<![endif] - >


感觉就像是一个黑客...... *笑嘻嘻*但是又一次,几乎每一个

''高级''我尝试过的东西最近在Javascript中做的感觉就像一个

hack! *感叹*


Rob

:)



Well, this seems to work ok:

<!--[if IE 5]>
<script language="javascript" type="text/javascript"
src="../bin/ieHoverFix.js"></script>
<![endif]-->

It feels like a hack.. *grin* but then again, just about every single
''advanced'' thing I try to do in Javascript lately ends up feeling like a
hack! *sigh*

Rob
:)


2004年7月27日星期二13:30 :55 + 1000,Robert Mark Bram< none>声明在

comp.lang.javascript,alt.html:
On Tue, 27 Jul 2004 13:30:55 +1000, Robert Mark Bram <none> declared in
comp.lang.javascript,alt.html:
<! - [if IE 5]>
< script language =" javascript" type =" text / javascript"
src =" ../ bin / ieHoverFix.js">< / script>
<![endif] - >


是的,就是那个。注意,上面只会影响IE5.x,而不是IE
。将第一行更改为<! - [if gte IE 5]>它将在

中起作用,从IE5上来。

感觉就像是黑客..


它是。 ;-)

* grin *但是又一次,几乎我在Javascript中尝试做的每一件事都是'高级'的事情最终感觉像是一个黑客! *叹气*
<!--[if IE 5]>
<script language="javascript" type="text/javascript"
src="../bin/ieHoverFix.js"></script>
<![endif]-->
Yep, that''s the one. Note that the above will only affect IE5.x, not
IE6. Change the first line to <!--[if gte IE 5]> and it will work in
anything from IE5 up.
It feels like a hack..
It is. ;-)
*grin* but then again, just about every single
''advanced'' thing I try to do in Javascript lately ends up feeling like a
hack! *sigh*




< g>


-

Mark Parnell http://www.clarkecomputers.com.au

在阅读usenet时不要喝朗姆酒和焦炭 - rf 2004



<g>

--
Mark Parnell
http://www.clarkecomputers.com.au
"Never drink rum&coke whilst reading usenet" - rf 2004


这篇关于检查是否支持悬停在非&lt; a&gt;上分子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆