 $(document).ready(function() {
 	var length2,
 		currentIndex2 = 0,
 		interval2,
 		hasStarted2 = false, //是否已经开始轮播 
 		t2 = 6000; //轮播时间间隔 
 	length2 = $('.slider-panel2').length;
 	//将除了第一张图片隐藏 
 	$('.slider-panel2:not(:first)').hide();


 	//鼠标上悬时显示向前、向后翻按钮,停止滑动，鼠标离开时隐藏向前、向后翻按钮，开始滑动 
 	$('.slider-panel2').hover(function() {
 		stop2();
 	}, function() {
 		start2();
 	});
 	
 	$('.slider-pre').unbind('click');
 	$('.slider-pre').bind('click', function() {
 		pre2();
 	});
 	$('.slider-next').unbind('click');
 	$('.slider-next').bind('click', function() {
 		next2();
 	});
 	/** 
 	 * 向前翻页 
 	 */
 	function pre2() {
 		var preIndex2 = currentIndex2;
 		currentIndex2 = (--currentIndex2 + length2) % length2;
 		play2(preIndex2, currentIndex2);
 	}
 	/** 
 	 * 向后翻页 
 	 */
 	function next2() {
 		var preIndex2 = currentIndex2;
 		currentIndex2 = ++currentIndex2 % length2;
 		play2(preIndex2, currentIndex2);
 	}
 	/** 
 	 * 从preIndex页翻到currentIndex页 
 	 * preIndex 整数，翻页的起始页 
 	 * currentIndex 整数，翻到的那页 
 	 */
 	function play2(preIndex, currentIndex) {
 		$('.slider-panel2').eq(preIndex).fadeOut(1000)
 			.parent().children().eq(currentIndex).fadeIn(2000);
 	}
 	/** 
 	 * 开始轮播 
 	 */
 	function start2() {
 		if(!hasStarted2) {
 			hasStarted2 = true;
 			interval2 = setInterval(next2, t2);
 		}
 	}
 	/** 
 	 * 停止轮播 
 	 */
 	function stop2() {
 		clearInterval2(interval2);
 		hasStarted2 = false;
 	}
 	//开始轮播 
 	start2();
 	$('body').on('touchstart', '.slider2', function(e) {
 		var touch = e.originalEvent,
 			slider = $(".slider2"),
 			startX = touch.changedTouches[0].pageX;
 		startY = touch.changedTouches[0].pageY;
 		slider.on('touchmove', function(e) {
 			e.preventDefault();
 			touch = e.originalEvent.touches[0] ||
 				e.originalEvent.changedTouches[0];
 			if(touch.pageX - startX > 10) {
 				console.log("右划");
 				pre2();
 				slider.off('touchmove');
 			} else if(touch.pageX - startX < -10) {
 				console.log("左划");
 				next2();
 				slider.off('touchmove');
 			};
 			if(touch.pageY - startY > 10) {
 				console.log("下划");
 			} else if(touch.pageY - startY < -10) {
 				console.log("上划");
 			};
 		});
 		return false;

 	}).on('touchend', function() {
 		$(".slider2").off('touchmove');
 	});
 });