Superfish 与 IE6 和 Apache Logs 的悬停问题
我在 ie6 上使用 jQuery Superfish 菜单,从我的会话的 Apache 日志文件中可以看到,每当我将鼠标悬停在 Superfish 菜单中具有子菜单的菜单项上时,用带有白色的菜单项表示菜单项标签右侧的箭头图像,一整堆(比如说 25 行)日志条目吐出,并带有以下类型的消息:
- - [23/Aug/2010:11:57:45 +1000] "GET /abcprod/images/arrows-ffffff.png HTTP/1.1" 304 - etc…..
我也不确定数字 304 表示在阿帕奇日志?
每次我将鼠标悬停在带有子菜单的菜单项上时,这些类型的条目都会继续出现,这还包括也有子菜单项的子菜单项。
但奇怪的是,当通过 Google Chrome 运行应用程序并检查 Apache 日志中的会话时,它确实会吐出与 arrows-ffffff.png 图像相关的任何内容。
ie6 和 Superfish 菜单悬停是怎么回事?
仅供参考,我还包括了 Superfish 用户与 f-sub-indicator 类相关的 CSS,即
.sf-sub-indicator {
position: absolute;
display: block;
right: .75em;
top: 1.05em; /* IE6 only */
width: 10px;
height: 10px;
text-indent: -999em;
overflow: hidden;
background: url("/abcprod/images/arrows-ffffff.png") no-repeat -10px -100px;
}
==>
a > .sf-sub-indicator { /* give all except IE6 the correct values */
top: .8em;
background-position: 0 -100px; /* use translucent arrow for modern browsers*/
}
/* apply hovers to modern browsers */
a:focus > .sf-sub-indicator,
a:hover > .sf-sub-indicator,
a:active > .sf-sub-indicator,
li:hover > a > .sf-sub-indicator,
li.sfHover > a > .sf-sub-indicator {
background-position: -10px -100px; /* arrow hovers for modern browsers*/
}
I am using jQuery Superfish menu on ie6 and from what I can see from the Apache log files for my session, is that whenever I hover over a menu item in my Superfish menu that has sub-menus, depicted with menu item that has a white arrow head image to the right of the menu item label, a whole heap (say 25 lines) of log entries spit out with the following type message:
- - [23/Aug/2010:11:57:45 +1000] "GET /abcprod/images/arrows-ffffff.png HTTP/1.1" 304 - etc…..
I am unsure also what the number 304 indicates where in the Apache log?
These types of entries keep on appearing every time I just hover over a menu item with sub-menus and this also includes sub-menu items that also have child menu items.
The strange thing is though, when running the app through Google Chrome and checking that session in the Apache logs, it does spit out anything relating to the arrows-ffffff.png image.
What is going on here with ie6 together with the Superfish menu hover?
FYI, I have also included CSS that Superfish users relating to the class f-sub-indicator, i.e.
.sf-sub-indicator {
position: absolute;
display: block;
right: .75em;
top: 1.05em; /* IE6 only */
width: 10px;
height: 10px;
text-indent: -999em;
overflow: hidden;
background: url("/abcprod/images/arrows-ffffff.png") no-repeat -10px -100px;
}
==>
a > .sf-sub-indicator { /* give all except IE6 the correct values */
top: .8em;
background-position: 0 -100px; /* use translucent arrow for modern browsers*/
}
/* apply hovers to modern browsers */
a:focus > .sf-sub-indicator,
a:hover > .sf-sub-indicator,
a:active > .sf-sub-indicator,
li:hover > a > .sf-sub-indicator,
li.sfHover > a > .sf-sub-indicator {
background-position: -10px -100px; /* arrow hovers for modern browsers*/
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于 IE6 不支持 :hover 伪选择器,我猜测 superfish 使用某种浏览器嗅探来应用 IE 特定的行为(类似于 这个)。
问题在于,由于 CSS 悬停规则被转换为 javascript 表达式,我猜测 IE 很愚蠢,每次 javascript 行为转换元素时都会请求一个新的 img。
一个可能的解决方案是确保 javascript 只切换某个类(假设它添加了 .hover 类),然后让 CSS 将背景应用到类选择器上。示例:
a:hover
变为a.hover
。Since IE6 doesn't support :hover pseudo-selectors, I'm guessing that superfish uses some kind of browser sniffing to apply IE-specific behaviours (something like this).
The problem with that is since the CSS hover rules are transformed onto javascript expressions, I'm guessing that IE is stupid enough to request a new img every time the javascript behaviour transforms the element.
A possible solution would be to ensure that the javascript only toggles some class (let's say it adds a .hover class) and then let CSS apply the background onto the class selector. An example:
a:hover
becomesa.hover
.不确定 IE6 环境中 SuperFish 的具体情况(不是已经死了吗?(-;) 和 jQuery,但“304”是一个 HTTP 代码,如 404、403 等。304 意味着该文件还没有自上次请求以来已被修改,可用于缓存、减少对服务器的请求等。
有关状态代码的更多信息,请参见:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
IE6 可能会在菜单时对此图像发出“GET”请求已激活... ? 正在请求同一文件 25 次... ? 激活带有箭头的第一个子菜单,并计算箭头的数量,然后检查日志条目的数量是否等于该数量。箭头,你知道IE6在做什么。
Unsure about the specifics for SuperFish in the context of IE6 (isn't it dead aleady? (-; ), and jQuery, but a "304" is an HTTP code like 404, 403, etc. A 304 means that file has not been modified since the last time it was requested. Comes in handy for caching, reducing requests to servers, etc.
More on status codes here:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
It is possible IE6 is making a "GET" request for this image when menu is activated ... ? It is requesting the same file 25 times ... ? Activate the first sub-menu with arrows, and count the number of arrows. Then check the logs. If the # of log entries is equal to the number of arrows, you know what IE6 is doing.