jquery支持移动手机的响应式轮播图插件
源码介绍
这是一款支持移动手机的响应式jquery轮播图插件。它具有跨平台,响应式,支持移动设备等特点,并且在使用CSS3制作过渡动画,效果非常炫酷。 在页面中引入jquery,hammer.min.js和slider.js文件以及图标样式文件entypo.css和CSS3动画样式文件style.css。 该jquery轮播图的基本HTML结构如下: 在页面DOM元素加载完毕之后,可以通过下面的方法来初始化该jquey轮播图插件。 该jquey轮播图插件的github地址为:https://github.com/pirolab/pirolab.github.io简要教程
使用方法
<link href="path/to/css/style.css" rel="stylesheet">
<link href="path/to/css/entypo.css" rel="stylesheet">
<script src=""path/to/js/jquery.min.js"></script>
<script src=""path/to/js/hammer.min.js"></script>
<script src=""path/to/js/slider.js"></script>
HTML结构
<div class='o-sliderContainer hasShadow' id="yourId">
<div class='o-slider' id='pbSlider'>
<div class="o-slider--item" data-image="images/5.jpg">
<div class="o-slider-textWrap">
<h1 class="o-slider-title">This is a title</h1>
<span class="a-divider"></span>
<h2 class="o-slider-subTitle">This is a sub title</h2>
<span class="a-divider"></span>
<p class="o-slider-paragraph">
This is a sub paragraph This is a sub paragraph
This is a sub paragraph This is a sub paragraph
This is a sub paragraph This is a sub paragraph
This is a sub paragraph </p>
</div>
</div>
<div class="o-slider--item" data-image="images/6.jpg">
<div class="o-slider-textWrap">
<h1 class="o-slider-title">This is a title</h1>
<span class="a-divider"></span>
<h2 class="o-slider-subTitle">This is a sub title</h2>
<span class="a-divider"></span>
<p class="o-slider-paragraph">
This is a sub paragraph This is a sub paragraph
This is a sub paragraph This is a sub paragraph
This is a sub paragraph This is a sub paragraph
This is a sub paragraph </p>
</div>
</div>
<div class="o-slider--item" data-image="images/1.jpg">
<div class="o-slider-textWrap">
<h1 class="o-slider-title">This is a title</h1>
<span class="a-divider"></span>
<h2 class="o-slider-subTitle">This is a sub title</h2>
<span class="a-divider"></span>
<p class="o-slider-paragraph">
This is a sub paragraph This is a sub paragraph
This is a sub paragraph This is a sub paragraph
This is a sub paragraph This is a sub paragraph
This is a sub paragraph </p>
</div>
</div>
<div class="o-slider--item" data-image="images/2.jpg">
<div class="o-slider-textWrap">
<h1 class="o-slider-title">This is a title</h1>
<span class="a-divider"></span>
<h2 class="o-slider-subTitle">This is a sub title</h2>
<span class="a-divider"></span>
<p class="o-slider-paragraph">
This is a sub paragraph This is a sub paragraph
This is a sub paragraph This is a sub paragraph
This is a sub paragraph This is a sub paragraph
This is a sub paragraph </p>
</div>
</div>
<div class="o-slider--item" data-image="images/3.jpg">
<div class="o-slider-textWrap">
<h1 class="o-slider-title">This is a title</h1>
<span class="a-divider"></span>
<h2 class="o-slider-subTitle">This is a sub title</h2>
<span class="a-divider"></span>
<p class="o-slider-paragraph">
This is a sub paragraph This is a sub paragraph
This is a sub paragraph This is a sub paragraph
This is a sub paragraph This is a sub paragraph
This is a sub paragraph </p>
</div>
</div>
<div class="o-slider--item" data-image="images/4.jpg">
<div class="o-slider-textWrap">
<h1 class="o-slider-title">This is a title</h1>
<span class="a-divider"></span>
<h2 class="o-slider-subTitle">This is a sub title</h2>
<span class="a-divider"></span>
<p class="o-slider-paragraph">
This is a sub paragraph This is a sub paragraph
This is a sub paragraph This is a sub paragraph
This is a sub paragraph This is a sub paragraph
This is a sub paragraph </p>
</div>
</div>
</div>
</div>
初始化插件
$('#pbSlider0').pbTouchSlider({
slider_Wrap : '#yourId', // Assign a unique ID to the div.o-sliderContainer
slider_Item : '.o-slider--item', // Single Item
slider_Drag : true, // Your choise.. to dragIt or not to dragIt..this is the question...
slider_Dots : { // Wanna see dots or not?
class :'.o-slider-pagination',
enabled : true
},
slider_Arrows : { // Wanna see Arrows or not?
class :'.o-slider-arrows',
enabled : true
},
slider_Threshold : 25, // Percentage of dragX before go to next/prev slider
slider_Speed : 1000,
slider_Ease : 'cubic-bezier(0.5, 0, 0.5, 1)', // see http://cubic-bezier.com/
slider_Breakpoints : { // Kind of media queries ( can add more if you know how to do it :D and if you need )
default : {
height : 500 // height on desktop
},
tablet : {
height : 400, // height on tablet
media : 1024 // tablet breakpoint
},
smartphone : {
height : 300, // height on smartphone
media : 768 // smartphone breakpoint
}
}
});
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » jquery支持移动手机的响应式轮播图插件
发表评论 取消回复