Splide is a lightweight, flexible and accessible slider/carousel written in TypeScript. No dependencies, no Lighthouse errors.
fork from : https://github.com/Splidejs/splide.git
|
5 vuotta sitten | |
---|---|---|
build | 5 vuotta sitten | |
dist | 5 vuotta sitten | |
src | 5 vuotta sitten | |
tests | 5 vuotta sitten | |
.babelrc | 5 vuotta sitten | |
.editorconfig | 5 vuotta sitten | |
.eslintrc | 5 vuotta sitten | |
.gitignore | 5 vuotta sitten | |
.npmignore | 5 vuotta sitten | |
LICENSE | 5 vuotta sitten | |
README.md | 5 vuotta sitten | |
gulpfile.js | 5 vuotta sitten | |
jest.config.js | 5 vuotta sitten | |
package-lock.json | 5 vuotta sitten | |
package.json | 5 vuotta sitten |
Splide is a lightweight, powerful and flexible slider and carousel, written in pure JavaScript without any dependencies.
There are 3 ways to install the Splide on your site.
Only NPM way is explained in the following steps. Visit this page for other methods.
Get the latest version by NPM:
$ npm install @splidejs/splide
html
<link rel="stylesheet" href="node_modules/@splidejs/splide/dist/css/splide.min.css">
Write HTML for building a slider:
<div id="#splide" class="splide">
<div class="splide__track">
<ul class="splide__list">
<li class="splide__slide">Slide 01</li>
<li class="splide__slide">Slide 02</li>
<li class="splide__slide">Slide 03</li>
</ul>
</div>
</div>
javascript
import splide from '@splidejs/splide';
splide( '#splide' ).mount();
Note that only the first element will be initialized even if using a class name.Pass an object to the second argument of splide()
:
splide( '#splide', {
type : 'loop',
perPage: 3,
} );
Or set a data-splide
attribute to a root element in a JSON format:
<div id="#splide" class="splide" data-splide="{"type":"loop","perPage":3}">
</div>
Here is a list of options and brief explanations. Visit [this page] for more details.
Splide provides some APIs and the way to customize the behaviour programmatically.
Splide is released under the MIT license.
© 2019 Naotoshi Fujita