当前位置:   article > 正文

基于superSlide的轮播-实用插件教程-源码-_superslide教程

superslide教程

superSlide实用案例加源码 轮播图篇 jquery以及superslide插件下载: https://pan.baidu.com/s/1z-446DTMdJ0o7R450BxYXw 提取码:sige


jquery以及superslide插件下载:
https://pan.baidu.com/s/1z-446DTMdJ0o7R450BxYXw
提取码:sige

1、 横向全屏焦点轮播

成品效果图

在这里插入图片描述

1、引入js文件

<script type="text/javascript" src="../../jquery1.42.min.js"></script>
  <script type="text/javascript" src="../../jquery.SuperSlide.2.1.1.js"></script>
  • 1
  • 2

下面展示一些 内联代码片
2、css部分

	<style type="text/css">
	/* css 重置 */
	*{margin:0; padding:0; list-style:none; }
	body{ background:#fff; font:normal 12px/22px 宋体; width:100%; }
	img{ border:0;  }
	a{ text-decoration:none; color:#333;  }
	a:hover{ color:#1974A1;  }
  /*以上为通用重置*/
	#footer{ text-align:center;  }
	.js{width:90%; margin:10px auto 0 auto; }
	.js p{ padding:5px 0; font-weight:bold; overflow:hidden;  }
	.js p span{ float:right; }
	.js p span a{ color:#f00; text-decoration:underline;   }
	.js textarea{ height:50px;  width:98%; padding:5px; border:1px solid #ccc; border-top:2px solid #aaa;  border-left:2px solid #aaa;  }


	/* 本例子css */
	.slider{ width:960px; margin:0 auto;  position:relative; overflow:hidden;   height:336px;; background:#000;  }
	.slider .bd{ position:relative; z-index:0;  }
	.slider .bd li{ height:336px; overflow:hidden; }
	.slider .bd li img{ display:block;  }

	.slider .hd{ width:100%;  position:absolute; z-index:1; bottom:0; left:0; height:30px; line-height:30px; }
	.slider .hd ul{ text-align:center;  }
	.slider .hd ul li{ cursor:pointer; display:inline-block; *display:inline; zoom:1; width:9px; height:9px; margin:0 4px; 
		background:url(images/dot.png) 0 -16px;
		overflow:hidden;  filter:alpha(opacity=70);opacity:0.7;  vertical-align:top; line-height:9999px; 
	}
	.slider .hd ul .on{ background-position:0 0;  }
	.slider .timer{ position:absolute; z-index:1; left:0; bottom:0; height:4px; width:0; background:#000; filter:alpha(opacity=40);opacity:0.4; font-size:0; overflow:hidden;   }
</style>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

3、本例子html代码


	<div class="slider">
		<div class="bd">
			<ul>
				<li><a target="_blank" href="Http://"><img src="images/1.jpg" /></a></li>
				<li><a target="_blank" href="Http://"><img src="images/2.jpg" /></a></li>
				<li><a target="_blank" href="Http://"><img src="images/3.jpg" /></a></li>
				<li><a target="_blank" href="Http://"><img src="images/4.jpg" /></a></li>
			</ul>
		</div>

		<div class="hd"><ul><li></li><li></li></ul></div>
		<div class="timer"></div><!-- 进度条 -->
	</div>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

4、本例子js代码

	

	<script type="text/javascript">
	
		jQuery(".slider").slide({ titCell:".hd ul", mainCell:".bd ul", effect:"fold",  autoPlay:true, autoPage:true, trigger:"click",
			mouseOverStop:false,/* 鼠标移到容器层继续播放*/
			/* 控制进度条 */
			startFun:function(){
				var timer = jQuery(".slider .timer");
				timer.stop(true,true).animate({ "width":"0%" },0).animate({ "width":"100%" },2500);
			}
		});
	</script>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

2、W3c首页焦点图

成品效果图

在这里插入图片描述
1、引入js文件

<script type="text/javascript" src="../../jquery1.42.min.js"></script>
  <script type="text/javascript" src="../../jquery.SuperSlide.2.1.1.js"></script>
  • 1
  • 2

2、CSS部分

<style type="text/css">
	/* css 重置 */
	*{margin:0; padding:0; list-style:none; }
	body{ background:#fff; font:normal 12px/22px 宋体; width:100%;  }
	img{ border:0;  }
	a{ text-decoration:none; color:#333;  }
	a:hover{ color:#1974A1;  }
	#footer{ text-align:center; padding-top:20px;  }

	/* 本例子css */
	.w3cFocus{ width:100%;  position:relative;  height:250px; padding:10px 0; background:#292929;    }
	.w3cFocus .prev,.w3cFocus .next{ position:absolute;  display:block;  left:10px; top:97px; width:46px; height:62px; background:url(images/focusAdvBg.png) no-repeat; filter:alpha(opacity=80);opacity:0.8;  }
	.w3cFocus .next{ left:auto; right:10px; background-position:-46px 0; }
	.w3cFocus .prev:hover,.w3cFocus .next:hover{ filter:alpha(opacity=100) !important;opacity:1 !important;  }
	.w3cFocusIn{ width:960px; height:250px; position:relative;  margin:0 auto;  overflow:hidden;  }
	.w3cFocusIn .bd li{ vertical-align:middle; }
	.w3cFocusIn .bd li img{ width:960px; height:250px; display:block;  }
	.w3cFocusIn .hd{ position: absolute; right:4px; bottom:6px;  }
	.w3cFocusIn .hd ul{ vertical-align:middle; display:inline-block; *display:inline; overflow:hidden; zoom:1; }
	.w3cFocusIn .hd ul li{  position:relative; float:left; display:inline; padding-top:4px;  margin-right:6px; filter:alpha(opacity=80); opacity:0.8;  cursor:pointer;  }
	.w3cFocusIn .hd ul li img{ width:76px; height:46px; border:2px solid #fff; display:block;  }
	.w3cFocusIn .hd ul li.on{ filter:alpha(opacity=100);opacity:1; background:url(images/focusArrow.png) center 0 no-repeat; }
	.w3cFocusIn .hd ul li.on img{ border:2px solid #3499EA; border-bottom-width:4px;   }

</style>

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26

3、js部分

<script type="text/javascript">

	//焦点图功能,用到SuperSlide插件
	jQuery(".w3cFocus").slide({ mainCell:".bd ul", effect:"fold", delayTime:300, autoPlay:true });

	//按钮位移函数
	function moveBtn(){
				var prev=jQuery(".w3cFocus .prev");
				var next=jQuery(".w3cFocus .next");

				var body_w = document.body.clientWidth;
				var side_w = (body_w - 960) / 2 -50;

				if(1080>parseInt(body_w))
				{
					prev.animate({"left":30, "opacity":0.5});
					next.animate({"right":30, "opacity":0.5});
				}
				else
				{
					prev.animate({"left":side_w, "opacity":0.5});
					next.animate({"right":side_w, "opacity":0.5});
				}
	}
	moveBtn();

	//拉伸浏览器时触发,为了适应不同浏览设备
	jQuery(window).resize(function(){moveBtn();});

</script>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

4、HTML部分

<div class="w3cFocus">

		<div class="w3cFocusIn">
					<div class="bd">
						<ul>
							<li><a target="_blank" href="http://www.superslide2.com"><img src="images/pic1.png" /></a></li>
							<li><a target="_blank" href="http://www.superslide2.com"><img src="images/pic2.jpg" /></a></li>
							<li><a target="_blank" href="http://www.superslide2.com"><img src="images/pic3.jpg" /></a></li>
							<li><a target="_blank" href="http://www.superslide2.com"><img src="images/pic4.jpg" /></a></li>
						</ul>
					</div>

					<div class="hd">
						<ul>
							<li><img src="images/pic1_s.png" /></li>
							<li><img src="images/pic2_s.png" /></li>
							<li><img src="images/pic3_s.png" /></li>
							<li><img src="images/pic4_s.png" /></li>
						</ul>
					</div>
		</div>
		<a class="prev" href="javascript:void(0)"></a>
		<a class="next" href="javascript:void(0)"></a>

</div>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25

3、真~全屏焦点图

成品效果图

在这里插入图片描述

1、引入js文件

<script type="text/javascript" src="../../jquery1.42.min.js"></script>
  <script type="text/javascript" src="../../jquery.SuperSlide.2.1.1.js"></script>
  • 1
  • 2

2、CSS部分

<style type="text/css">
	/* css 重置 */
	*{margin:0; padding:0; list-style:none; }
	body{ background:#fff; font:normal 12px/22px 宋体; width:100%; }
	img{ border:0;  }
	a{ text-decoration:none; color:#333;  }
	a:hover{ color:#1974A1;  }
	#footer{ text-align:center;  }

	/* 本例子css */
	body,html{ width:100%; height:100%; ;   } 
	.fullSlide{ position:absolute; left:0; top:0; width:100%;  height:100%;  min-width:1000px; background:#000  }
	.fullSlide ul{ height:100% !important; width:100% !important;  }
	.fullSlide li{  height:100% !important; width:100% !important; }
	.fullSlide .prev,
	.fullSlide .next{ position:absolute; z-index:1; display:block; width:30px; height:50px; top:50%; margin-top:-100px; left:20px;  
		background:url(images/icons.png) 0 0 no-repeat; 
		cursor:pointer;  filter:alpha(opacity=60);opacity:0.6;  }
	.fullSlide .next{ left:auto; right:30px; background-position:-51px 0; }
	.fullSlide .prev:hover,
	.fullSlide .next:hover{ filter:alpha(opacity=100);opacity:1; }
	.fullSlide .playState{ display:block; position:absolute; z-index:1; right:30px; top:50%; margin-top:-20px; width:51px; height:51px; overflow:hidden;  background:url(images/icons.png) 23px -132px #000  no-repeat; filter:alpha(opacity=60);opacity:0.6;  }
	.fullSlide .pauseState{ background-position:23px -201px; }
	.fullSlide .playState:hover{ filter:alpha(opacity=100);opacity:1;  }

	.nav li{ width:120px; float:left; text-align:center; border:1px solid #d50000; border-top:0; border-bottom:0; margin-left:-1px;  }
	.nav li a{ display:block;  color:#fff; height:100%;  }
	.nav li a:hover,.nav li.on a{ background:#880000; color:#fff;  } 


</style>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

3、HTML部分

	<div class="fullSlide">
		<ul>
			<li style="background:url(images/1.jpg) center center no-repeat;"></li>
			<li style="background:url(images/2.jpg) center center no-repeat;"></li>
			<li style="background:url(images/3.jpg) center center no-repeat;"></li>
		</ul>
		<a class="prev" href="javascript:void(0)"></a>
		<a class="next" href="javascript:void(0)"></a>
		<a class="playState" href="javascript:void(0)"></a>
	</div>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

4、js部分

	<script type="text/javascript">
			
		jQuery(".fullSlide").slide({ mainCell:"ul", effect:"fold",  autoPlay:true, mouseOverStop:false });

	</script>
  • 1
  • 2
  • 3
  • 4
  • 5

4、前后图片预览-焦点图

成品效果图

在这里插入图片描述

1、引入js文件

<script type="text/javascript" src="../../jquery1.42.min.js"></script>
  <script type="text/javascript" src="../../jquery.SuperSlide.2.1.1.js"></script>
  • 1
  • 2

2、CSS部分

<style type="text/css">
	/* css 重置 */
	*{margin:0; padding:0; list-style:none; }
	body{ background:#fff; font:normal 12px/22px 宋体; width:100%; }
	img{ border:0;  }
	a{ text-decoration:none; color:#333;  }
	a:hover{ color:#1974A1;  }
	#footer{ text-align:center;  }
	.js{width:90%; margin:10px auto 0 auto; }
	.js p{ padding:5px 0; font-weight:bold; overflow:hidden;  }
	.js p span{ float:right; }
	.js p span a{ color:#f00; text-decoration:underline;   }
	.js textarea{ height:50px;  width:98%; padding:5px; border:1px solid #ccc; border-top:2px solid #aaa;  border-left:2px solid #aaa;  }


	/* 本例子css */
	.slider{ width:630px;  height:338px; padding:0 130px;  margin:0 auto;  position:relative; overflow:hidden; background:#000;  }
	.slider .bd{ position:absolute; left:0; top:0; }
	.slider .bd li{ overflow:hidden; }
	.slider .bd li img{ display:block; width:630px; height:338px;    }
	.slider .tempWrap{ padding:0 130px !important; /* 强制遮罩层显示2侧各130px */   }
	.slider .bd ul{ margin-left:-630px !important;  }
	.slider .pnBtn{ position:absolute; top:0; width:130px; height:338px; cursor:pointer;   }
	.slider .prev{ left:0;  }
	.slider .next{ right:0; }
	.slider .pnBtn .blackBg{ display:block;  position:absolute; left:0; top:0; width:100%; height:338px; background:#000; filter:alpha(opacity=50);opacity:0.5;   }
	.slider .pnBtn .arrow{ display:none; position:absolute; top:0; z-index:1; width:32px; height:338px; _filter:alpha(opacity=70); }
	.slider .prev .arrow{ left:0; background:url(images/left.png) 0 center no-repeat;   }
	.slider .next .arrow{ right:0; background:url(images/right.png) 0 center no-repeat;  }

</style>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

3、HTML部分

		<div class="slider">
		
		<div class="bd">
			<ul>
				<li><a target="_blank" href="http://www.superslide2.com"><img src="images/1.jpg" /></a></li>
				<li><a target="_blank" href="http://www.superslide2.com"><img src="images/2.jpg" /></a></li>
				<li><a target="_blank" href="http://www.superslide2.com"><img src="images/3.jpg" /></a></li>
				<li><a target="_blank" href="http://www.superslide2.com"><img src="images/4.jpg" /></a></li>
			</ul>
		</div>

		<div class="pnBtn prev">
			<span class="blackBg"></span>
			<span class="arrow"></span>
		</div>
		<div class="pnBtn next">
			<span class="blackBg"></span>
			<span class="arrow"></span>
		</div>

	</div>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

4、js部分

	<script type="text/javascript">
		/* 把最后一个放到第一个前面,然后通过外层ul{margin-left:-630px !important; }来显示第一个 */
		jQuery(".slider .bd li").first().before( jQuery(".slider .bd li").last() );
		/* 控制左右按钮显示 */
		jQuery(".slider .pnBtn").hover(function(){ jQuery(this).find(".arrow").show() },function(){ jQuery(this).find(".arrow").hide() });
		/* 调用SuperSlide */
		jQuery(".slider").slide({ mainCell:".bd ul", effect:"leftLoop",  autoPlay:true, vis:3, mouseOverStop:false });
	</script>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号