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 năm trước cách đây | |
---|---|---|
build | 5 năm trước cách đây | |
dist | 5 năm trước cách đây | |
src | 5 năm trước cách đây | |
tests | 5 năm trước cách đây | |
.babelrc | 5 năm trước cách đây | |
.editorconfig | 5 năm trước cách đây | |
.eslintrc | 5 năm trước cách đây | |
.gitignore | 5 năm trước cách đây | |
.npmignore | 5 năm trước cách đây | |
LICENSE | 5 năm trước cách đây | |
README.md | 5 năm trước cách đây | |
gulpfile.js | 5 năm trước cách đây | |
jest.config.js | 5 năm trước cách đây | |
package-lock.json | 5 năm trước cách đây | |
package.json | 5 năm trước cách đây |
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 the 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