显示/隐藏菜单在IE7中不起作用

时间:2012-08-08 11:11:27

标签: jquery html css

我用jQuery创建了DropDown菜单。一切都很好,除了IE7。根本不工作。它只使粗体成为最后一个环节。我不知道如何调试它。

我创建了this fiddle.

有没有人有解决方案?

这是JS不起作用:

 $(".link-dropdown").on({
        click: function(){
            var $this = $(this);

            if ($this.parent().next().is(":visible")){
                $('.opening-holder').hide();
                $('.link-dropdown').css({
                    'fontFamily': 'Geogrotesque-Regular, Arial, sans-serif'
                });
            } else {
                $('.opening-holder').hide();
                $('.link-dropdown').css({
                    'fontFamily': 'Geogrotesque-Regular, Arial, sans-serif'
                });

                $this.css({
                    'fontFamily': 'Geogrotesque-SemiBold, Arial, sans-serif'
                });

                $this.parent().next().show();
                $this.parent().next().children().show();
            }

            return false;
        }
    });

3 个答案:

答案 0 :(得分:1)

我为解决方案创造了小提琴http://jsfiddle.net/EMnw3/27/ 如果可见,我禁用它并且有效...

答案 1 :(得分:0)

这与您使用:visible的事实有关。

答案 2 :(得分:0)

试试这个:

我刚刚对jQuery脚本进行了更改,它的工作原理如下:

$(function(){
    $(".link-dropdown").on({
        click: function(){
            var $this = $(this);

            if ($this.css("dispaly") == "block;"){
                $('.opening-holder').hide();
                $('.link-dropdown').css({
                    'fontFamily': 'Geogrotesque-Regular, Arial, sans-serif'
                });
            } else {
                $('.opening-holder').hide();
                $('.link-dropdown').css({
                    'fontFamily': 'Geogrotesque-Regular, Arial, sans-serif'
                });

                $this.css({
                    'fontFamily': 'Geogrotesque-SemiBold, Arial, sans-serif'
                });

                $this.parent().show();
                $this.parent().children().show();
            }

            return false;
        }
    });
});
相关问题