my要的轮播照片墙


<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>照片墙</title> 
<style> 
	.div-main {margin:0 auto}
	.div-a{ float:left;width:55%;} 
	.div-a img {width:600px;height: 400px;}
	.div-b{ float:right;width:45%; } 
	.filmstrip li { width:100px; height:50px; overflow:hidden; }
	.filmstrip img { width:80px; height:45px; }
</style> 
<script>
	onload = function() {
		var number = 1;//用来控制什么跳右边缩略图
		var count = 0;//用来控制左边大图
		var lis = document.getElementsByTagName("li");
		var funny = function(i){
			if(i == 0)
			{
				lis[0].onclick = function(){
					number--;
					count--;
					//控制左边的大图
					if(count >= 0 && count <= 9)
					{
						var img = document.getElementById("large");
						img.src = "./img/image"+((count+1)%10)+".jpg";
					}else{
						count++;
					}
					
					//移动右边的缩略图向上一次
					if(number == -1)
					{
						for(var j=2;j<8;j++)
						{
							var img = document.getElementById("small"+j);
							img.src = "./img/image"+((j+count-1)%10)+".jpg";
						}
						number++;
					}
				}
			}
			if(i > 0 && i < lis.length-1)
			{
				lis[i].onclick = function(){
					var img = document.getElementById("large");
					var img2 = document.getElementById("small"+(i+1));
					img.src = img2.src;
				}
			}
			if(i == lis.length-1) 	
			{
				lis[lis.length-1].onclick = function(){
					number++;
					count++;
					
					//控制左边的大图
					if(count >= 0 && count <= 9)
					{
						var img = document.getElementById("large");
						img.src = "./img/image"+((count+1)%10)+".jpg";
					}else{
						count--;
					}
					
					//移动右边的缩略图向下一次
					if(number == 6)
					{
						for(var j=2;j<8;j++)
						{
							var img = document.getElementById("small"+j);
							img.src = "./img/image"+((j+count-6)%10)+".jpg";
						}
						number--;
					}
				}
			}
		}
		
		for(var i=0;i<lis.length;i++){
			funny(i);
		}
	}
</script>
</head> 
<body> 
<div id = "container" class = "div—main">
	<p>照片墙</p>
	<div class="div-a"><img id = "large" src = "img/image1.jpg" /> </div> 
		<div class="div-b">
				<ul id = "images" class="filmstrip">
					<li><img id = "small1" src="img/up.png" /></li>
					<li><img id = "small2" src="img/image1.jpg" /></li>
					<li><img id = "small3" src="img/image2.jpg" /></li>
					<li><img id = "small4" src="img/image3.jpg" /></li>
					<li><img id = "small5" src="img/image4.jpg" /></li>  
					<li><img id = "small6" src="img/image5.jpg" /></li>  
					<li><img id = "small7" src="img/image6.jpg" /></li>  
					<li><img id = "small8" src="img/down.png" /></li>
				</ul>
		</div> 
</div>
</body> 
</html> 



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值