jQuery css()
set css background color update
<!DOCTYPE html> <html lang="en"> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="js/jquery-ui.js"></script> <script> $(document).ready(function() { changeBG();/* w ww. j a va 2 s . co m*/ }); function changeBG() { var speed = 1500; $("body") .animate({backgroundColor:"#D68A85"}, speed) //red .animate({backgroundColor:"#E7912D"}, speed) //orange .animate({backgroundColor:"#CECC33"}, speed) //yellow .animate({backgroundColor:"#6FCD94"}, speed) //green .animate({backgroundColor:"#3AB6F1"}, speed) //blue .animate({backgroundColor:"#8684D8"}, speed) //purple .animate({backgroundColor:"#DD67AE"}, speed); //pink changeBG(); } </script> </head> <body></body> </html>