1.
超链接的颜色渐变(以下有三种方式)
<style>
.a{
color:red;
}
.b{
color:green;
}
.c{
color:white;
}
</style>
</head>
<script type="text/javascript" src="JS/jquery.js"></script>
<script type="text/javascript" src="JS/interface.js"></script>
<script type="text/javascript"><%--
$(document).ready(function(){
$("a").each(function(){
$(this).css("color","#eee")
}).hover(function(){
$(this).animate({style:"color:red"})
},function(){
$(this).animate({style:"color:#eee"})
})
});
$(document).ready(function(){
$("a").each(function(){
$(this).css("color","white");
}).hover(function(){
$(this).css("color","red");
},function(){
$(this).css("color","green");
});
});
$(document).ready(function(){
$("a").hover(function(){
$(this).addClass("a");
},function(){
$(this).removeClass("a");
});
});
</script>
2.图片的颜色渐变
<body style="background:#000;">
<img src="http://www.cssrain.cn/skins/tim/logo-jq.gif" /> <br/><br/>
<img src="http://www.cssrain.cn/demo/JQuery+API/logo-json.gif" /> <br/><br/>
<img src="http://www.baidu.com/img/logo.gif" /> <br/><br/>
<img src="http://www.google.cn/intl/zh-CN/images/logo_cn.gif" /> <br/>
<script>
$('img').each(function(){$(this).css("opacity",".6")})
.hover(function(){$(this).animate({
opacity:"1"
})
},function(){
$(this).animate({
opacity:".6"
})
});
</script>
</body>
说明:
css(name, value) :$(this).css("opacity",".6") 在所有匹配的元素中,设置一个样式属性的值。
animated : $(this).animate({opacity:"1"}) 用于创建自定义动画的函数.
3.循环显示文字或者图片