1

我的 css3 动画菜单运行良好。但现在我想给selected他增加一些课程。

但我不知道如何用 css3 动画实现。

我试过这个:

$('#menu a').click(function(e) {
            e.preventDefault();
            $(this).addClass("selected");
            var h = $(this).attr('href');
            $("#conteudo").fadeOut("slow", function() {
                $(this).html($(h).html()).fadeIn("slow");
            });
        });

但不工作。我做了这个小提琴:http: //jsfiddle.net/8L797/

4

2 回答 2

1

我修复了这个selected类,我还让点击事件从现有链接中删除了这个类。

小提琴:http: //jsfiddle.net/iambriansreed/TNzuH/

CSS:

#menu a.selected span,
#menu a.selected:hover span {
    top: -100%;
}
#menu a.selected em,
#menu a.selected:hover em {
    top: 0;
}
于 2012-06-18T19:34:53.947 回答
0

你的代码中有一些错误,比如没有关闭你的 jQuery 函数。此外,看起来您的样式适用于 LI 标记,而不是 A 标记,因此您需要将类添加到 LI。查看我更新的 jsFiddle,看看你是否可以使用它。

于 2012-06-18T19:23:27.147 回答