以下是 jquery动态文字颜色切换js代码 的示例演示效果:
部分效果截图:
HTML代码(index.html):
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="JS代码,动态文字,动态背景,文字颜色,jQuery特效" />
<meta name="description" content="jQuery动态改变文字和背景颜色效果,更多动态文字,动态背景,文字颜色" />
<title>jQuery动态改变文字和背景颜色效果</title>
<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript" src="jquery.color.js"></script>
<script type="text/javascript">
$(document).ready(function() {
spectrum();
function spectrum(){
var hue = 'rgb(' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ')';
$('#welcome').animate( { backgroundColor: hue }, 1000);
spectrum();
}
});
</script>
<style type="text/css">
*{ margin:0; padding:0; }
body { text-align: center; background:#191919; color:#FFFFFF; }
a{ color:#FFCC00;}
img{ border: none; }
#welcome{ position: fixed; top: 5%; left: 50%; margin-left: -271px; background:#A8D2F5; }
</style>
</head>
<body>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<div id="welcome"><img src="welcome.png"/></div>
</body>
</html>