如何动画文章边框

时间:2013-02-26 19:07:29

标签: jquery html5

我有简单的文章元素<article id="why-me" style="">text</article>,风格为:

article {
    background: none repeat scroll 0 0 #000000;
    border: 2px solid #353535;
    box-shadow: 0 0 5px black;
    opacity: 0.8;
}

section#content article {
    background: none repeat scroll 0 0 #050505;
    border-radius: 3px 3px 3px 3px;
    margin-bottom: 20px;
    padding: 10px;
    position: relative;
    z-index: 5;
}

所以我尝试像jQuery('#why-me').animate({'borderColor': '#717171'});那样做闪光边框,但没有任何反应......问题出在哪里?

2 个答案:

答案 0 :(得分:1)

默认情况下,颜色动画不是jQuery的一部分。你需要一个插件:

http://www.bitstorm.org/jquery/color-animation/

答案 1 :(得分:0)

如果包含jquery,则必须指定动画的持续时间:

jQuery('#why-me').animate({'borderColor': '#717171'},fast);