3.0.2 • Published 3 years ago

@wide/modulus-slider v3.0.2

Weekly downloads
108
License
MIT
Repository
github
Last release
3 years ago

Modulus Slider

Enhanced slider component, based on Swiper, to be used with @wide/modulus.

Install

npm install @wide/modulus-slider --save

Usage

Register this component using Modulus:

import modulus from '@wide/modulus'
import Slider from '@wide/modulus-slider'

modulus.component('slider', Slider)

Import base scss styles (contains Swiper styles):

@use '@wide/modulus-slider';
/**
 * Add pagination module for this example
 * @tutorial https://swiperjs.com/swiper-api#modules
 */
@use 'node_modules/swiper/modules/pagination/pagination.scss';

And use the provided twig template:

{% include '@wide::modulus-slider' with {
  webcomponent: true,
  slides: [
    'Some HTML',
    'Some HTML again'
  ],
  pagination: true,
  dataset: {
    sync: '#slider2'
  }
} %}

Or build your own html:

<div class="slider swiper" is="slider" data-sync="#slider2">
    <div class="swiper-wrapper">
        <div class="slider_slide swiper-slide">
            Some HTML
        </div>
        <div class="slider_slide swiper-slide">
            Some HTML again
        </div>
    </div>
    <div class="slider_pagination swiper-pagination"></div>
</div>

Advanced usage

Extend the Slider class and change the configuration (see Swiper API):

import modulus from '@wide/modulus'
import Slider from '@wide/modulus-slider'
/**
 * Add pagination module for this example
 * @tutorial https://swiperjs.com/swiper-api#modules
 */
import { Pagination } from 'swiper'

modulus.component('slider', class extends Slider {
    run() {
        const config = {
          slidesPerView: 1,
          modules: [ Pagination ]
        }
        super.run({ config })
    }
}

Libraries

This package uses :

Authors

License

This project is licensed under the MIT License - see the licence file for details

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

4 years ago

2.3.1

3 years ago

2.3.0

4 years ago

2.2.3

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

0.0.1-beta.3

5 years ago

0.0.1-beta.2

5 years ago

0.0.1-beta.1

5 years ago

0.0.1-beta.0

5 years ago