ws2z3gr2017 7 years ago
parent
commit
7d7970801f
3 changed files with 9 additions and 10 deletions
  1. 1 2
      src/css/index_home.css
  2. 4 4
      src/js/index.js
  3. 4 4
      src/js/public.js

+ 1 - 2
src/css/index_home.css

@@ -9,7 +9,6 @@ body{font:14px "simsun",Arial,Helvetica,sans-serif;width:100%;
     user-select:none;
 }
 body,h1,h2,h3,h4,h6,p,ul,ol,dl,dd{margin:0;padding:0;list-style:none;}
-
 a{color:#000;text-decoration:none;}
 a:hover{color:#000;text-decoration:none;}
 .lf{float:left;}
@@ -127,7 +126,7 @@ display:inline-block;position: absolute;top:0;left:0;}
 .need_imgs{width: 1018px;overflow: hidden;position: absolute;left: 50%;margin-left: -500px;top: 0;}
 .carousel .need_prev{width: 30px;height: 34px;font-size: 24px;text-align: center;line-height: 34px;background: #686868;display: inline-block;color: #FFFFFF;position: absolute;top:90px;left:50px;box-shadow: 2px 2px 10px #333333;}
 .carousel ul{float: left;width: 100000px;}
-.carousel ul li{float: left;padding-left: 10px;padding-right: 10px;text-align: center;padding-bottom: 20px;}
+.carousel ul li{float: left;margin-left: 10px;margin-right: 10px;text-align: center;padding-bottom: 20px;}
 .carousel ul li p{font-size: 14px;color: #404040;line-height: 52px;background: #ffffff;box-shadow: 2px 2px 10px #333333;}
 .carousel ul li img{width: 320px;height:160px;}
 .carousel .need_next{position: absolute;top:90px;right:30px;width: 30px;height: 34px;font-size: 24px;text-align: center;line-height: 34px;background: #686868;display: inline-block;color: #FFFFFF;box-shadow: 2px 2px 10px #333333;}

+ 4 - 4
src/js/index.js

@@ -6,21 +6,21 @@ import './public.js'
 
 $(function(){
 	var k=0;
-	var liwit=$('.need_imgs ul li').width()	
-	var lilengths=$('.need_imgs ul li').length	
+	var liwit=$('.need_imgs ul li').width();
+	var lilengths=$('.need_imgs ul li').length;
 	$('.need_next').click(function(){
 		k++;
 		if(k>lilengths-3){
 			k=0
 		}
-		$('.need_imgs ul').animate({'marginLeft':-(liwit)*k})
+		$('.need_imgs ul').animate({'marginLeft':-(liwit+20)*k})
 	});
 	$('.need_prev').click(function(){
 		k--;
 		if(k<0){
 			k=lilengths-3
 		}
-		$('.need_imgs ul').animate({'marginLeft':-(liwit)*k})
+		$('.need_imgs ul').animate({'marginLeft':-(liwit+20)*k})
 	});
 });
 

+ 4 - 4
src/js/public.js

@@ -22,7 +22,7 @@ $(function(){
 	var lock=false;
 		function playnext(){
 			$ct.animate({marginLeft:'-='+mov*imgWidth},function(){
-				curidx++;
+				curidx+=mov;
 				if(curidx===imgCount){
 					$ct.css({marginLeft:0-imgWidth});
 					curidx=0;
@@ -32,10 +32,10 @@ $(function(){
 		}		
 		function playpre(){
 			$ct.animate({marginLeft:'+='+mov*imgWidth},function(){
-				curidx--;
-				if(curidx===(-1)){
+				curidx-=mov;
+				if(curidx<0){
 					$ct.css({marginLeft:0-imgWidth*imgCount});
-					curidx=3;
+					curidx=2;
 				}    				
 			})
 			$('.index_tt .banner_txt').eq(curidx).show().siblings().hide();