zoukankan      html  css  js  c++  java
  • jQuery效果-淡入淡出

    fadein

    html

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8" />
            <title>jquery</title>
            <script type="text/javascript" src="js/jquery-3.0.0.min.js"></script>
            <script type="text/javascript" src="js/try.js" ></script>
        </head>
        <style>
            #div1 {
                
                display:none;
                100px;
                height:100px ;
                background-color:seagreen ;
            }
            #div2 {
                display:none;
                80px;
                height:80px ;
                background-color:skyblue ;
            }
            #div3 {
                display:none;
                60px;
                height:60px ;
                background-color:salmon ;
            }
        </style>
        <body>
            <button id="fadein">
                fadein
            </button>
            <div id="div3" ></div>
            <br>
            <div id="div2" ></div>
            <br>
            <div id="div1" ></div>
            <br>
            
        </body>
    </html>

    try.js

    $(document).ready(function(){
    	$("#fadein").on("click",function(){
    		$("#div1").fadeIn(3000);
    		$("#div2").fadeIn(2000);
    		$("#div3").fadeIn(1000);
    	})
    });
    

      fadeout

     html

    <!DOCTYPE html>
    <html>
    	<head>
    		<meta charset="utf-8" />
    		<title>jquery</title>
    		<script type="text/javascript" src="js/jquery-3.0.0.min.js"></script>
    		<script type="text/javascript" src="js/try.js" ></script>
    	</head>
    	<style>
    		#div1 {
    			
    			display:none;
    			100px;
    			height:100px ;
    			background-color:seagreen ;
    		}
    		#div2 {
    			display:none;
    			80px;
    			height:80px ;
    			background-color:skyblue ;
    		}
    		#div3 {
    			display:none;
    			60px;
    			height:60px ;
    			background-color:salmon ;
    		}
    	</style>
    	<body>
    		<button id="fadein">
    			fadein
    		</button>
    		<button id="fadeout">
    			fadeout
    		</button>
    		<div id="div3" ></div>
    		<br>
    		<div id="div2" ></div>
    		<br>
    		<div id="div1" ></div>
    		<br>
    		
    	</body>
    </html>
    

      try.js

    $(document).ready(function(){
    	$("#fadein").on("click",function(){
    		$("#div1").fadeIn(3000);
    		$("#div2").fadeIn(2000);
    		$("#div3").fadeIn(1000);
    	})
    	$("#fadeout").on("click",function(){
    		$("#div1").fadeOut(3000);
    		$("#div2").fadeOut(2000);
    		$("#div3").fadeOut(1000);
    	})
    });
    

      效果:

    toggle

    html

    <!DOCTYPE html>
    <html>
    	<head>
    		<meta charset="utf-8" />
    		<title>jquery</title>
    		<script type="text/javascript" src="js/jquery-3.0.0.min.js"></script>
    		<script type="text/javascript" src="js/try.js" ></script>
    	</head>
    	<style>
    		#div1 {
    			
    			display:none;
    			100px;
    			height:100px ;
    			background-color:seagreen ;
    		}
    		#div2 {
    			display:none;
    			80px;
    			height:80px ;
    			background-color:skyblue ;
    		}
    		#div3 {
    			display:none;
    			60px;
    			height:60px ;
    			background-color:salmon ;
    		}
    	</style>
    	<body>
    		<button id="fadein">
    			fadein
    		</button>
    		<button id="fadeout">
    			fadeout
    		</button>
    		<button id="toggle">
    			toggle
    		</button>
    		<div id="div3" ></div>
    		<br>
    		<div id="div2" ></div>
    		<br>
    		<div id="div1" ></div>
    		<br>
    		
    	</body>
    </html>
    

      js

    $(document).ready(function(){
    	$("#fadein").on("click",function(){
    		$("#div1").fadeIn(3000);
    		$("#div2").fadeIn(2000);
    		$("#div3").fadeIn(1000);
    	})
    	$("#fadeout").on("click",function(){
    		$("#div1").fadeOut(3000);
    		$("#div2").fadeOut(2000);
    		$("#div3").fadeOut(1000);
    	})
    	$("#toggle").on("click",function(){
    		$("#div1").toggle(3000);
    		$("#div2").toggle(2000);
    		$("#div3").toggle(1000);
    	})
    });
    

      效果:

     fadeto

    html

    <!DOCTYPE html>
    <html>
    	<head>
    		<meta charset="utf-8" />
    		<title>jquery</title>
    		<script type="text/javascript" src="js/jquery-3.0.0.min.js"></script>
    		<script type="text/javascript" src="js/try.js" ></script>
    	</head>
    	<style>
    		#div1 {
    			
    			display:none;
    			100px;
    			height:100px ;
    			background-color:seagreen ;
    		}
    		#div2 {
    			display:none;
    			80px;
    			height:80px ;
    			background-color:skyblue ;
    		}
    		#div3 {
    			display:none;
    			60px;
    			height:60px ;
    			background-color:salmon ;
    		}
    	</style>
    	<body>
    		<button id="fadein">
    			fadein
    		</button>
    		<button id="fadeout">
    			fadeout
    		</button>
    		<button id="toggle">
    			toggle
    		</button>
    		<button id="fadeto">
    			fadeto
    		</button>
    		<div id="div3" ></div>
    		<br>
    		<div id="div2" ></div>
    		<br>
    		<div id="div1" ></div>
    		<br>
    		
    	</body>
    </html>
    

      js

    $(document).ready(function(){
    	$("#fadein").on("click",function(){
    		$("#div1").fadeIn(3000);
    		$("#div2").fadeIn(2000);
    		$("#div3").fadeIn(1000);
    	})
    	$("#fadeout").on("click",function(){
    		$("#div1").fadeOut(3000);
    		$("#div2").fadeOut(2000);
    		$("#div3").fadeOut(1000);
    	})
    	$("#toggle").on("click",function(){
    		$("#div1").toggle(3000);
    		$("#div2").toggle(2000);
    		$("#div3").toggle(1000);
    	})
    	$("#fadeto").on("click",function(){
    		$("#div1").fadeTo(3000,0.3);
    		$("#div2").fadeTo(2000,0.5);
    		$("#div3").fadeTo(1000,0.7);
    	})
    });
    

      效果:

     

  • 相关阅读:
    C++ 虚函数表解析(转载)
    javaWeb中的/路径问题
    java创建多线程(转载)
    JSP中pageEncoding和charset区别,中文乱码解决方案(转载)
    Class.forName()的作用与使用总结(转载)
    Java内存模型
    java-锁膨胀的过程
    java对象头信息和三种锁的性能对比
    并发容器
    synchronized和volatile以及ReentrantLock
  • 原文地址:https://www.cnblogs.com/guangzhou11/p/7568106.html
Copyright © 2011-2022 走看看