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
|
há 5 anos atrás | |
---|---|---|
build | há 5 anos atrás | |
dist | há 5 anos atrás | |
src | há 5 anos atrás | |
tests | há 5 anos atrás | |
.babelrc | há 5 anos atrás | |
.editorconfig | há 5 anos atrás | |
.eslintrc | há 5 anos atrás | |
.gitignore | há 5 anos atrás | |
.npmignore | há 5 anos atrás | |
LICENSE | há 5 anos atrás | |
README.md | há 5 anos atrás | |
gulpfile.js | há 5 anos atrás | |
jest.config.js | há 5 anos atrás | |
package-lock.json | há 5 anos atrás | |
package.json | há 5 anos atrás |
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