当前位置: 移动技术网 > IT编程>开发语言>JavaScript > 基于jquery实现的文字淡入淡出效果

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

2019年03月19日  | 移动技术网IT编程  | 我要评论

代码如下:


<!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> 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网