这篇文章介绍了jquery实现的文字淡入淡出效果实例,有需要的朋友可以参考一下复制代码代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档- www.jbxue.com</title>
<script type="text/javascript" language="javascript" src="../../jquery-1.7.1.min.js">
</script>
<script language="javascript">
$(document).ready(function(){
$("#btn1").toggle(function(){
$("p").fadeOut("slow");
},function(){
$("p").fadeIn("slow");
});
$("#btn2").toggle(function(){
$("p").fadeTo("slow",0.66);
},function(){
$("p").fadeTo("slow",0.66);
});
});
</script>
</head>
<body>
<p style="background:#3F3">this is pi<br>
this is pi<br>
this is pi<br>
this is pi<br>
this is pi<br>
this is pi<br>
</p>
<input type="button" value="淡入/淡出" id="btn1">
</body>
<input type="button" value="淡入/淡出 效果 透明度0.66" id="btn2">
</html>
复制代码代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档- www.jbxue.com</title>
<script type="text/javascript" language="javascript" src="../../jquery-1.7.1.min.js">
</script>
<script language="javascript">
$(document).ready(function(){
$("#btn1").toggle(function(){
$("p").fadeOut("slow");
},function(){
$("p").fadeIn("slow");
});
$("#btn2").toggle(function(){
$("p").fadeTo("slow",0.66);
},function(){
$("p").fadeTo("slow",0.66);
});
});
</script>
</head>
<body>
<p style="background:#3F3">this is pi<br>
this is pi<br>
this is pi<br>
this is pi<br>
this is pi<br>
this is pi<br>
</p>
<input type="button" value="淡入/淡出" id="btn1">
</body>
<input type="button" value="淡入/淡出 效果 透明度0.66" id="btn2">
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档- www.jbxue.com</title>
<script type="text/javascript" language="javascript" src="../../jquery-1.7.1.min.js">
</script>
<script language="javascript">
$(document).ready(function(){
$("#btn1").toggle(function(){
$("p").fadeOut("slow");
},function(){
$("p").fadeIn("slow");
});
$("#btn2").toggle(function(){
$("p").fadeTo("slow",0.66);
},function(){
$("p").fadeTo("slow",0.66);
});
});
</script>
</head>
<body>
<p style="background:#3F3">this is pi<br>
this is pi<br>
this is pi<br>
this is pi<br>
this is pi<br>
this is pi<br>
</p>
<input type="button" value="淡入/淡出" id="btn1">
</body>
<input type="button" value="淡入/淡出 效果 透明度0.66" id="btn2">
</html>
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步