Slide me 👇
Intro
Tiny-Swiper is an ingenious open-source JavaScript Carousel powered by wonderful plugins with native-like experience.
It's lightweight yet extensible. You can import plugins as needed, no more, no less. Just like this:
import Swiper, {
SwiperPluginLazyload,
SwiperPluginPagination
} from 'tiny-swiper'
Usage
Installation
# via npm
$ npm install tiny-swiper --save
# via yarn
$ yarn add tiny-swiper
If you prefer CDN
<script src="https://unpkg.com/tiny-swiper@latest"></script>
Initialization
Html code:
<!-- Slider main container -->
<div class="swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
<div class="swiper-slide">Slide 1</div>
<div class="swiper-slide">Slide 2</div>
<div class="swiper-slide">Slide 3</div>
...
</div>
<!-- If we need pagination -->
<div class="swiper-pagination"></div>
</div>
JavaScript/TypeScript code:
import Swiper, {
SwiperPluginLazyload,
SwiperPluginPagination
} from 'tiny-swiper'
Swiper.use([ SwiperPluginLazyload, SwiperPluginPagination ])
const swiper = new Swiper(swiperContainer: HTMLElement | string, parameters?: TinySwiperParameters)
-
new Swiper()
- initialize swiper with options. -
Swiper.use()
- Register plugin. -
swiperContainer
- HTMLElement or string (with CSS Selector) of swiper container HTML element. Required. -
parameters
- object with Swiper parameters. Optional.
You also can load full-featured Tiny-Swiper:
import Swiper from 'tiny-swiper/lib/index.full.js'
<script src="https://unpkg.com/tiny-swiper@latest/lib/index.full.js"></script>
Demos
Default Setup
Loop mode
Pagination
Lazyload
BTW, I'm Planing to create Vue/React/Svelte version of Tiny-Swiper.
You can find me on Github Or Homepage if there are some ideas and suggestions :)
Top comments (0)