菜鸟学堂
在线运行
源代码
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>颜色动画(Color Animation)演示</title> <link rel="stylesheet" href="http://apps.bdimg.com/libs/jqueryui/1.10.4/css/jquery-ui.min.css"> <style> #elem { color: #006; background-color: #aaa; font-size: 25px; padding: 1em; text-align: center; } </style> <script src="http://apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script> <script src="http://apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> </head> <body> <div id="elem">颜色动画</div> <button id="toggle">改变颜色</button> <script> $( "#toggle" ).click(function() { $( "#elem" ).animate({ color: "green", backgroundColor: "rgb( 20, 20, 20 )" }); }); </script> </body> </html>
运行结果
在线运行
菜鸟学堂 edu.jb51.net