Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery background colour change animate not working

I want to change the background of an inputbox from white to another colour and then back to white again in a slow fading way. i have tried the animate it simply doesn't work. there is no error.

<script type="text/javascript" src="/jsp/ui/jquery-ui/js/jquery-1.8.3.min.js"></script>
...
$(document.getElementById(id)).animate({ backgroundColor: "#4E1402" }, 500);

update

This works fine

$(document.getElementById(id)).animate({ width: "400px" }, 500);
like image 718
code511788465541441 Avatar asked Dec 06 '25 17:12

code511788465541441


1 Answers

jQuery cannot animate color. Use this plugin instead.

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

( just a 4kb addition )

Or the jquery UI animate :

http://jqueryui.com/animate/ ( as mentioned by @Adam below )

like image 199
DhruvPathak Avatar answered Dec 08 '25 06:12

DhruvPathak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!