码迷,mamicode.com
首页 > Web开发 > 详细

html+css实现京东换图片

时间:2015-02-26 10:02:41      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:jquery   javascript   图片   京东   

<strong><!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
  <style type="text/css">
		*{margin:0px; padding:0px;}
		.ad{margin:120px auto;width:520px;height:280px; background:#f00;position:relative;
			overflow:hidden;}
		.pic{width:520px ;height:280px;/*border:1px solid #000*/}
		.pic ul{width:26000px ;height:280px;top:0px;left:-520px;position:absolute;}
		.pic ul li{list-style-type:none;width:520px ;height:280px;/*border:1px solid #ffff00;*/float:left;}
		.left,.right{width:40px;height:40px;background:rgba(167,167,167,0.5);color:#fff;font-size:28px;
			text-align:center;line-height:40px;top:120px;cursor:pointer;position:absolute;}
			.left:hover,.right:hover{background:rgba(167,167,167,0.8)}
		.left{left:5px;}
		.right{right:5px;}
  </style>
 </head>
 <body>
	<div class="ad">
		<div class="pic">
			<ul>
				<li><img src="img/5.jpg"/></li>
				<li><img src="img/1.png"/></li>
				<li><img src="img/2.jpg"/></li>
				<li><img src="img/3.jpg"/></li>
				<li><img src="img/4.jpg"/></li>
				<li><img src="img/5.jpg"/></li>
				<li><img src="img/1.png"/></li>
			</ul>
		</div>
		<div class="left">
			<
		</div>
		<div class="right">
			>
		</div>
	</div>
	<script src="js/jquery.js"></script>
	<script>
		var a= 1;
		var Time = new Date();
		$(".right").click(function(){
			if((new Date()-Time)>1000){	
				Time = new Date();
				//alert(Time);
				a=a+1;
				var lef = -a*520 +"px";
				//$(".pic ul").animate({left:"-520px"},1000);
				$(".pic ul").animate({left:lef},1000,function(){
					if(a==6){$(".pic ul").css("left","-520px");a=1;}
				});
			}
		});
		$(".left").click(function(){
			if((new Date()-Time)>1000){	
				Time = new Date();
				a=a-1;
				var lef =-a*520 +"px";
				//$(".pic ul").animate({left:"-520px"},1000);
				$(".pic ul").animate({left:lef},1000,function(){
					if(a==0){$(".pic ul").css("left","-2600px");a=5;}
				});
			}
		});
	</script>
 </body>
</html>
</strong>
技术分享技术分享

html+css实现京东换图片

标签:jquery   javascript   图片   京东   

原文地址:http://blog.csdn.net/u012651389/article/details/43940405

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!