jquery基于swiper商品细节图片轮播翻转代码



143 568 190



特效描述:jquery 基于swiper 商品细节 图片轮播翻转,jquery swiper.js商品图片轮播,图片翻转代码,适用于各大商城网站商品细节展示的图片切换效果,是一款有创意和实用的商品细节展示代码。

代码结构

1. 引入CSS

<link rel="stylesheet" type="text/css" href="css/reset.css">
<link rel="stylesheet" type="text/css" href="css/swiper.min.css">
<link rel="stylesheet" type="text/css" href="css/reset.css">
<link rel="stylesheet" type="text/css" href="css/swiper.min.css">

2. 引入JS

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/swiper.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/swiper.js"></script>

3. HTML代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body style="background:#b9b9b9;">
<style type="text/css">
.dp-pic .swiper-container{height:833px;}
.dp-pic .swiper-pagination-bullet{width:16px;height:16px;background:#fff;opacity:0.5;}
.dp-pic .swiper-pagination-bullet-active{background:#007aff;opacity:1;}
.part_mrdp{width:990px;margin:20px auto;}
.part_mrdp .p_left{float:left;width:395px;}
.part_mrdp .p_right{float:left;width:555px;overflow:hidden}
.blk_mrdp{background:url(img/U7526P1503DT20160331144008.png) 0 0 no-repeat;padding-top: 170px;position: relative;}
.list01 li{line-height:36px;}
.list01 li a{font-size: 23px;color: #4c4c4c;line-height: 36px;padding-left: 1rem;transition: padding-left 1s;
-moz-transition: padding-left 1s; /* Firefox 4 */
-webkit-transition: padding-left 1s; /* Safari 和 Chrome */
-o-transition: padding-left 1s; /* Opera */}
.list01 li a:visited{text-decoration: none;}
.list01 li a:hover{text-decoration: none;}
.list01 .selected a{font-size: 23px;color: #000;padding-left: 0rem;}
.banner-inner .date{position: absolute;top:633px;left:540px;width: 111px;height: 94px;}
.banner-inner .date .month{font-size: 16px;color: #ffdca2;display: block;line-height: 30px;height: 30px;overflow: hidden;text-align: center;}
.banner-inner .date .day{font-size: 52px;color: #ffdca2;display: block;line-height: 60px;height: 60px;overflow: hidden;text-align: center;font-family: 'arial';margin-top: 3px;}
.banner-inner .editor{position: absolute;top:705px;left: 420px;text-align: center;}
.banner-inner .editor .avatar{display: block;width: 93px;height: 93px;overflow: hidden;border-radius: 50%;}
.banner-inner .editor label{color: #fff;font-size: 12px;display: block;line-height: 20px;}
.banner-inner .editor .name{font-size: 16px;color: #fff;display: block;}
.banner-inner .txt{color: #fff;font-size: 18px;line-height: 24px;position: absolute;left: 535px;bottom: 30px;}
.swiper01{position: absolute;width: 564px;height: 366px;top: 416px;left: 0;z-index:99;}
</style>
<div class='part_mrdp clearfix'>
<!--每日单品 start-->
	<div class='p_left'>
	<!--left_part start-->
		<div class="blk_mrdp">
		<!--单品滚动 start-->
			<ul class='list01 j-scrollPage01'>
				<li class='selected'><a href="javascript:;">印花长裙:Tory Burch</a></li>
				<li><a href="javascript:;">手提包:Valextra</a></li>
				<li><a href="javascript:;">凉鞋:MICHAEL Michael Kors</a></li>
			</ul>
			<div class='swiper01 swiper-container'>
				<div class='swiper-wrapper'>
					<div class='swiper-slide'><img src="img/U5790P1503DT20170613164501.jpg" width='564px'></div>
					<div class='swiper-slide'><img src="img/U5790P1503DT20170613164503.jpg" width='564px'></div>
					<div class='swiper-slide'><img src="img/U5790P1503DT20170613164503_1.jpg" width='564px'></div>
				</div>
			</div>	
		<!--单品滚动 end-->
		</div>
	<!--left_part start-->	
	</div>
	<div class='p_right dp-pic'>
	<!--right_part start-->
	<!-- Swiper -->
		<div class="swiper-container">
			<div class="swiper-wrapper">
				<div class="swiper-slide"><img src="img/U5790P1503DT20170614142416.jpg" width='555px'></div>
				<div class="swiper-slide"><img src="img/U5790P1503DT20170614142506.jpg" width='555px'></div>
				<div class="swiper-slide"><img src="img/U5790P1503DT20170614142516.jpg" width='555px'></div>
			</div>
			<!-- Add Pagination -->
			<div class="swiper-pagination"></div>
		</div>
	<!--right_part start-->	
	</div>
</div>	
<script type="text/javascript">
var dpData = [
//team1
[
   {
      pic:'img/U5790P1503DT20170613164501.jpg',
      name:'印花长裙:Tory Burch'
    },
    {
      pic:'img/U5790P1503DT20170613164503.jpg',
      name:'手提包:Valextra'
    },
    {
      pic:'img/U5790P1503DT20170613164503_1.jpg',
      name:'凉鞋:MICHAEL Michael Kors'
    },
  ],
//team2
[
   {
      pic:'img/U5790P1503DT20170614144533.jpg',
      name:'无袖上衣:Carven'
    },
    {
      pic:'img/U5790P1503DT20170614144533_1.jpg',
      name:'印花半裙:Fabitoria'
    },
    {
      pic:'img/U5790P1503DT20170614144534.jpg',
      name:'手提包:Jimmy Choo '
    },
 {
      pic:'img/U5790P1503DT20170614144534_1.jpg',
      name:'短靴:Giuseppe Zanotti '
    },
 {
      pic:'img/U5790P1503DT20170614144535.jpg',
      name:'戒指:Tiffany&Co. '
    },
  ],
//team3
[
   {
      pic:'img/U5790P1503DT20170614145547.jpg',
      name:'连衣裙:Lanvin'
    },
    {
      pic:'img/U5790P1503DT20170614145548.jpg',
      name:'高跟鞋:Giuseppe Zanotti'
    },
 {
      pic:'img/U5790P1503DT20170614145549.jpg',
      name:'腕表、项链:Tiffany&Co.'
    },
 {
      pic:'img/U5790P1503DT20170614145551.jpg',
      name:'手提包:MICHAEL Michael Kors'
    },
  ],
];
function initSwip(){
  var mySwiper = new Swiper('.swiper01',{
    effect : 'cube',
    direction : 'vertical',
    autoplay:3000,
    autoplayDisableOnInteraction : false,
    cube: {
        slideShadows: false,
        shadow: false
    },
onSlideChangeEnd: function(swiper){
        $('.j-scrollPage01 li').removeClass('selected');
        var curIndex = swiper.activeIndex;
        $('.j-scrollPage01 li').eq(curIndex).addClass('selected');
      }
  });
  $('.j-scrollPage01 a').on('mouseover',function(){
    var $this = $(this),
      curIndex = $this.parent().index();
    $('.j-scrollPage01 li').removeClass('selected');
    $this.parent().addClass('selected');
    mySwiper.slideTo(curIndex)
  }); 
}
    var swiper02 = new Swiper('.dp-pic .swiper-container', {
        pagination: '.dp-pic .swiper-pagination',
        direction: 'vertical',
        slidesPerView: 1,
        paginationClickable: true,
        spaceBetween: 30,
        mousewheelControl: true,
        onSlideChangeEnd:function(s){
            var index = s.activeIndex;
var liStr = [],
			  swipImgStr = [];
		for(var i=0;i<dpData[index].length;i++){
		 var  tempClass='';
		  if(i==0){tempClass='selected';}
		  liStr.push('<li ><a class="'+tempClass+'" href="javascript:;">'+dpData[index][i].name+'</a></li>');
		  swipImgStr.push('<div class="swiper-slide"><img src="'+dpData[index][i].pic+'" width="564px"></div>');
		}
		$('.list01').html(liStr.join(''));
		  $('.swiper01 .swiper-wrapper').html(swipImgStr.join(''));
		  initSwip();
	 }
});
initSwip();
</script>
</body>
</html>



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: 滚动 滚动条 页面滚动 滚动插件 滚动条插件 滚动条美化 滑动选项卡 滑动切换 滚动切换 滚动条切换 flash焦点图 flash幻灯片 flashbanner flash图片轮播 自动滚动图片轮播 叠加浮动层 选项卡切换 选项卡 切换 tab切换 页面切换 选项卡插件 切换插件 滑动手风琴 层叠叠加 叠加层叠 层叠 叠加 加载更多 旋转翻转 旋转 翻转 焦点图 幻灯片 轮播图 bar焦点图 图片叠加 图片层叠 图片翻转 图片旋转 图片滚动 图片滚动条 纯图片轮播 图片轮播 自动滚动图片轮播 选项卡自动切换

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到