简体   繁体   English

jQuery Navigation在IE7中不起作用

[英]jQuery Navigation not working in IE7

I have the following code in a project for the main navigation. 我在主导航项目中有以下代码。 It is essentially a css-sprite that is overlayed once the user hovers over the menu. 实际上,它是一个css-sprite,一旦用户将鼠标悬停在菜单上,它就会被覆盖。 This is working perfectly in every browser except IE7 (ie6 not tested). 这在除IE7(即未经测试的IE7)之外的所有浏览器中均能完美运行。 I have tried debugging my css and feel this is coming from jQuery / JS code specifically. 我尝试调试我的CSS,并且感觉这是专门来自jQuery / JS代码的。 Is there some jQ code I may be using that is causing the error? 我可能正在使用某些导致错误的jQ代码吗? Any and all help is appreciated. 任何和所有帮助表示赞赏。

The issue is that once hovered the span is not showing in IE7. 问题是,一旦悬停,跨度就不会显示在IE7中。 All other browsers work a-okay. 所有其他浏览器都可以正常工作。

  jQuery('#menu-main-navigation').find('li > a')
         .append('<span class="hover"></span>')
         .hover(function() {
              jQuery('.hover', this)
                .stop()
                .animate({
            opacity: 1
                }, 400 )
            }, function() {
           jQuery('.hover', this)
            .stop()
            .animate({
               opacity: 0
             }, 300)
             });                
          jQuery("#menu-main-navigation a").find('.hover').css({opacity:0})

Thank you in advance, 先感谢您,

J Ĵ

IE7 doesn't support opacity , you need filter: alpha(opacity=50); IE7不支持opacity ,您需要filter: alpha(opacity=50);

It's not safe to code alone, take this http://www.quirksmode.org/css/opacity.html 单独编写代码并不安全,请参考http://www.quirksmode.org/css/opacity.html

The answer above is incorrect. 上面的答案是不正确的。 jQuery does support opacity for IE7. jQuery确实支持IE7的不透明度。 It was a css issue after all, the positioning was off on the <li> tag. 毕竟这是一个css问题, <li>标记上的位置已关闭。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM