欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

基于jquery实现的文字淡入淡出效果

程序员文章站 2024-02-04 13:11:34
代码如下:

代码如下:


<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "https://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> 
<html xmlns="https://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
<title>无标题文档</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>