• jq 点击按钮换图运动


    <!DOCTYPE html>
    <html lang="en">
    <head>
    	<meta charset="UTF-8">
    	<title>Document</title>
    	<style>
    	*{margin:0; padding:0;}
    	.outer{800px; height:400px; overflow:hidden; margin:0 auto;}
    	.inner{3200px; height:400px; position:relative;}
    	.inner ul{ position:absolute; left:0; top: 0;}
    	.inner ul li{ float:left;}
    	.inner ul li img{ 800px; height:400px;}
    	.prePage{ 50px; height:100px; line-height:100px; display:block; margin-top:-50px; font-size:40px; text-align:center; background:rgba(200,200,200,0.5); position:absolute; left: 0;top: 50%;}
    	.nextPage{50px; height:100px; line-height:100px; display:block; margin-top:-50px; font-size:40px; text-align:center; background:rgba(200,200,200,0.5); position:absolute; left:750px;top: 50%;}
    	</style>
    
    	<script src="jquery-2.2.2.min.js"></script>
    	<script>
    	$(function(){
    		var page = 1;
    		$(".prePage").click(function(){
    			page--;
    			if(page < 1)
    			{
    				page = 4;
    			}
    			changePage(page);
    		})
    
    		$(".nextPage").click(function(){
    			clearInterval(time);
    			page++;
    			if(page>5)
    			{
    				page = 1;
    			}
    			changePage(page);
    		
    		})
    
    		var time = null;
    		
    		function changePage(page){
    			
    				var num1 =page * (-800);
    
    				if(num1 <= -4000)
    				{
    					num1 = -800;
    				}
    				
    				$(".inner > ul").animate({"left":num1},500)
    
    		}
    		
    		
    	
    	})
    		
    	</script>
    </head>
    <body>
    	<div class="outer">
    		<div class="inner">
    			<ul style = "left:-800px">
    				<li><img src="img/292326.jpg" height="768" width="1366" alt=""></li>
    				<li><img src="img/292321.jpg" height="768" width="1366" alt=""></li>
    				<li><img src="img/292323.jpg" height="768" width="1366" alt=""></li>
    				<li><img src="img/292325.jpg" height="768" width="1366" alt=""></li>
    				<li><img src="img/292326.jpg" height="768" width="1366" alt=""></li>
    				<li><img src="img/292321.jpg" height="768" width="1366" alt=""></li>
    
    			</ul>
    			
    				<span class="prePage"><</span>
    				<span class="nextPage">></span>
    		</div>
    	</div>
    	
    </body>
    </html>
    

      

  • 相关阅读:
    minecraft我的世界汇总网站
    扫雷网页版
    扫雷模型(非完全一样)
    设计模式-策略模式
    hadoop(2)hadoop配置
    hadoop(1)入门
    Openssl
    加密解密
    信息安全通信
    Web
  • 原文地址:https://www.cnblogs.com/mingjixiaohui/p/5294227.html
Copyright © 2020-2023  润新知