How to animate background color in jQuery? -


what doing wrong following doesn't animate background color?

<div style="height:100px;width:100px;background:red">animate this</div><br> <input type="button" id="mybutton" value="start"/><br>   $("#mybutton").click(function(){    $("div").animate({backgroundcolor: 'blue'}); }); 

http://jsfiddle.net/bjf2l0ha/

you need import additional plugin such jquery ui in order support color in animate() function jquery alone doesn't.

$("#colorbtn").click(function() {    $('#demodiv').animate({backgroundcolor: 'blue'})  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>  <input type="button" id="colorbtn" value="change color"/><br>    <div id="demodiv" style="height:100px;width:100px;background:red"></div>


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -