Mobile-friendly Slider/Carousel - jQuery flickGal
| File Size: | 10.9 KB |
|---|---|
| Views Total: | 6071 |
| Last Update: | |
| Publish Date: | |
| Official Website: | Go to website |
| License: | MIT |
flickGal is a small jQuery plugin used to create a responsive, touch-enabled, flickable slider or carousel on the web & mobile.
Works with all modern browsers that support CSS3 3D transforms.
You users can flick through slides with mouse drag or touch swipe events, or by clicking navigation arrows & pagination bullets.
How to use it:
1. Add slides together with navigation and pagination controls to the flickGal.
<div class="yourFlickgalWrap">
<div class="container">
<div class="containerInner">
<div id="slide01" class="item">Item 1</div>
<div id="slide02" class="item">Item 2</div>
<div id="slide03" class="item">Item 3</div>
</div>
</div>
<div class="arrows">
<a href="javascript:void(0);" class="prev"><< </a>
<a href="javascript:void(0);" class="next"> >></a>
</div>
<div class="nav">
<ul>
<li class="slide01"><a href="#slide01">・</a></li>
<li class="slide02"><a href="#slide02">・</a></li>
<li class="slide03"><a href="#slide03">・</a></li>
</ul>
</div>
</div>
2. Add jQuery library and the minified version of the flickGal plugin to the page.
<script src="/path/to/cdn/jquery.slim.min.js"></script> <script src="/path/to/jquery.flickgal.js"></script>
3. Attach the function flickGal to the top container.
$('.yourFlickgalWrap').flickGal();
4. The example CSS styles for the slider & controls.
/* core styles */
.yourFlickgalWrap .item { width: 200px }
.yourFlickgalWrap .moving {
-webkit-transition: -webkit-transform .2s ease-out;
-moz-transition: -moz-transform .2s ease-out;
}
.yourFlickgalWrap .containerInner {
overflow: hidden;
}
.yourFlickgalWrap .containerInner .item {
display: inline-block;
height: 180px;
line-height: 180px;
text-align: center;
margin: 0 5px;
border: 1px #10A29A solid;
background: lightseagreen;
color: rgba(0,0,0,.4);
font-weight: bold;
font-size: 200%;
-webkit-user-select: none;
user-select: none;
}
/* pagination bullets */
.yourFlickgalWrap .nav {
text-align: center;
}
.yourFlickgalWrap .nav li {
display: inline-block;
}
.yourFlickgalWrap .nav li a {
text-decoration: none;
color: rgba(0,0,0,.2);
font-size: 300%;
}
.yourFlickgalWrap .nav li a:hover {
background: lightgray;
}
.yourFlickgalWrap .nav li a:active {
background: gray;
}
.yourFlickgalWrap .nav .selected a {
color: rgba(0,0,0,1);
}
/* navigation arrows */
.yourFlickgalWrap .arrows {
font-size: 300%;
}
.yourFlickgalWrap .arrows a {
text-decoration: none;
color: rgba(0,0,0,.6);
}
.yourFlickgalWrap .arrows a:hover {
background: lightgray;
color: rgba(0,0,0,1);
}
.yourFlickgalWrap .arrows a:active {
background: gray;
}
.yourFlickgalWrap .arrows a.off {
color: rgba(0,0,0,.2);
background: none;
}
.yourFlickgalWrap .arrows .prev {
float: left;
}
.yourFlickgalWrap .arrows .next {
float: right;
}
5. Initialize the plugin as a carousel. Default: false.
$('.yourFlickgalWrap').flickGal({
'infinitCarousel': true
})
6. Set the initial slide index on page load. Default: 0 (slide 1).
$('.yourFlickgalWrap').flickGal({
'startIndex': 1
})
7. Determine whether to lock horizontal scroll if you have large items in slides. Default: true.
$('.yourFlickgalWrap').flickGal({
'lockScroll': false
})
8. Event handlers.
$('.yourFlickgalWrap').flickGal({
'infinitCarousel': true
})
.on('fg_flickstart', function(e, index) {
// do something
})
.on('fg_flickend', function(e, index) {
// do something
})
.on('fg_change', function(e, index) {
// do something
});
This awesome jQuery plugin is developed by piglovesyou. For more Advanced Usages, please check the demo page or visit the official website.










