1.6.0 • Published 5 years ago
awesome-swiper v1.6.0
Awesome Swiper
- This package has been migrated to @cycjimmy/awesome-swiper for scoped NPM package. Please switch to @cycjimmy/awesome-swiper to stay up to date.
- awesome-swiper based on swiper 4. (Releases | Demo)
Install
# via npm
$ npm install awesome-swiper --save
# or via yarn
$ yarn add awesome-swiperUsage
Awesome Swiper based on Swiper 4. Add Script of swiper4 in your project first
import Swiper from 'swiper';
import AwesomeSwiper from 'awesome-swiper';
// OR
const Swiper = require('swiper');
const AwesomeSwiper = require('awesome-swiper');let awesomeSwiper = new AwesomeSwiper([SwiperModule]).init(context [, ...config] [, ...overlayConfig]);
// if need thumbs
let awesomeSwiper = new AwesomeSwiper([SwiperModule])
.init(context [, ...config] [, ...overlayConfig])
.addThumbs(thumbsContext [, ...thumbsConfig] [, ...thumbsExtraConfig]);AwesomeSwiper() params:
SwiperModule: Object Set custom swiper constructor. Make sure the swiper version is 4.
AwesomeSwiper().init() params:
context: String | Element the wrapper of swiper. Height and width of wrapper must be initialized.- config: Object
speed: Number Duration of transition between slides (in ms). Default300.loop: Boolean Set totrueto enable loop. Defaultfalse.autoplay: Number Set autoplay delay.0means close. Default0.direction: String Set direction. Could be'horizontal'or'vertical'. Default'horizontal'.spaceBetween: Number Distance between slides in px. Default0.slidesPerView: Number | 'auto' Number of slides per view. Default1.mousewheel: Boolean Set totrueto enable navigation through slides using mouse wheel. Defaultfalse.autoFixFullImg: Boolean Settrueto auto fix full images. Defaultfalse. Tip: Due to the impact of performance, not necessary not to set it.pagination: Object Set pagination. If you do not want a pagination, setnull.color: String'default'is blue. You also can set'black'or'white'and embed your own stylestyle: Object Custom pagination style. Recommended to only adjust the position here.dynamicBullets: Boolean Good to enable if you use bullets pagination with a lot of slides. So it will keep only few bullets visible at the same time. Defaultfalse. See Swiper Pagination
navigation: Object Set navigation. If you do not want a navigation, setnull.color: String'default'is blue. You also can set'black'or'white'styles: Object Custom stylecustom: Object Set custom navigation elements. Defaultnull.prevEl: String | Element Custom prev button element.nextEl: String | Element Custom next button element.
- overlayConfig: Object Use Custom swiper api to overlay config.
AwesomeSwiper().addThumbs() params:
thumbsContext: String | Element the wrapper of thumbs. Height and width of wrapper must be initialized.- thumbsConfig: Object You can set it follow swiper api.
direction: String Set direction. Could be'horizontal'or'vertical'.spaceBetween: Number Distance between slides in px. Default10.slidesPerView: Number | 'auto' Number of slides per view. Default'auto'.
- thumbsExtraConfig: Object Extra config for thumbs.
new css classes in AwesomeSwiper
.swiper-full-img: Full images container..swiper-full-bg: Full background container..swiper-explain: Explain text container..active-thumb: Active slide of thumbs.
Use in browser
<link href="swiper.min.css" rel="stylesheet">
<div id="basic" class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">slide1</div>
...
</div>
</div>
<script src="swiper.min.js"></script>
<script src="AwesomeSwiper.min.js"></script>
<script>
new AwesomeSwiper().init('#basic');
</script>or use standalone:
<div id="basic" class="swiper-container">
...
</div>
<script src="AwesomeSwiper.standalone.min.js"></script>
<script>
new AwesomeSwiper().init('#basic');
</script>Be sure to use the same version of JS and CSS files
CDN
<script src="https://cdn.jsdelivr.net/npm/awesome-swiper@1/build/AwesomeSwiper.min.js"></script>
// standalone
<script src="https://cdn.jsdelivr.net/npm/awesome-swiper@1/build/AwesomeSwiper.standalone.min.js"></script>Compatibility
- chrome >= 46
- safari >= 8
- firefox >= 40
- ie >= 11
- ios >= 8
- android >= 4.4
1.5.2
5 years ago
1.6.0
5 years ago
1.5.1
5 years ago
1.5.0
5 years ago
1.4.3
6 years ago
1.4.2
6 years ago
1.4.1
6 years ago
1.4.0
6 years ago
1.3.0
6 years ago
1.2.2
7 years ago
1.2.1
7 years ago
1.2.0
7 years ago
1.1.1
7 years ago
1.1.0
8 years ago
1.0.3
8 years ago
1.0.2
8 years ago
1.0.1
8 years ago
1.0.0
8 years ago
0.1.4
8 years ago
0.1.3
8 years ago
0.1.2
8 years ago
0.1.1
8 years ago
0.1.0
8 years ago