Text fading in and out based on jquery

  • 2020-03-29 23:47:07
  • OfStack


<!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> Headless document </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=" Fade in / Fade out " id="btn1">  
</body>  
<input type="button" value=" Fade in / Fade out   The effect   transparency 0.66" id="btn2">  
</html>  


Related articles: