jQuery animate background color not animating

白昼怎懂夜的黑 提交于 2019-12-23 03:41:45

问题


http://jsfiddle.net/leonwho/98mD2/

HTML

<div id="account-setup-guide">
    <div id="account_tour_info">
        <ul>
            <li class="setup_complete"><strong>1</strong> Sync!</li>
        </ul>
    </div>
</div>

CSS

#account-setup-guide {
    position: relative;
    margin: 30px 30px 20px 20px;
    padding: 20px;
    width: auto;
    border: 5px solid orange;
    background: orange;
}

jQuery

var animateThis = function() {

    console.log('run animateThis');

    $('#account-setup-guide').stop().animate({backgroundColor: '#ffffff'}, 500);

    $('#account-setup-guide').animate({
        background: 'white'
    }, 500);
}

animateThis();

Not sure why this isn't working, I've used both examples above of the .animate but it's not working in my current jsfiddle test :(


回答1:


jQuery doesn't support animation of color, you have to include plugin which support it as jQuery UI or jQuery color:

jQuery color

jsFiddle (thx to kei)



来源:https://stackoverflow.com/questions/21049005/jquery-animate-background-color-not-animating

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!