1.1.1 • Published 6 years ago

@veams/component-slider v1.1.1

Weekly downloads
16
License
MIT
Repository
github
Last release
6 years ago

Slider

Description

The component represents a simple but powerful slider.

The slider module is a component for cycling through elements, like a carousel or slideshow. It allows users to swipe on touch-enabled devices.


Requirements


Installation

Installation with Veams

veams install component slider
veams -i c slider

Fields

slider.hbs

The partial is a \{{#wrapWith}} helper. Documentation for wrapWith helper.

Settings

ParameterTypeValueDescription
settings.sliderContextClassStringdefaultContext class of component.
settings.sliderClassesStringModifier classes for component.
settings.sliderJsOptionsObjectJavaScript options which gets stringified.
settings.sliderInnerFullWidthBooleanfalseDelete the class .is-container from .slider__content.
settings.sliderHidePaginationBooleanfalseHide the pagination when set to true.

slider__controls.hbs

Content

ParameterTypeDescription
content.sliderButtonsObjectContains the controls content. When the object is not defined, the controls will not be printed out.
content.sliderButtons.prevStringDefine the button text for the previous button.
content.sliderButtons.nextStringDefine the button text for the next button.

slider__list.hbs

The partial is a \{{#wrapWith}} helper. Documentation for wrapWith helper.

Settings

ParameterTypeDescription
settings.sliderOverflowBooleanSet this option to true if you want to add the class .is-overflow which gives you the possibility to show all hidden items next to the active element(s).

slider__item.hbs

The partial is a \{{#wrapWith}} helper. Documentation for wrapWith helper.


JavaScript Options

The module gives you the possibility to override default options:

OptionTypeDefaultDescription
autoPlayBooleanfalseEnable AutoPlay option of the slider
autoPlayIntervalNumber3000AutoPlay speed in milliseconds
classes.activeString'is-active'Class for the active slide
classes.cloneClassString'is-cloned'For the infinite slider the last and first element gets cloned. The cloning class can be overridden
classes.disabledString'is-disabled'Class for disabled next/prev button
classes.hiddenString'is-hidden'The hidden class used by handling the visibility of the slider
classes.paginationItemString'slider__pagination-list-item'Class which used in mini template
classes.slidingStringis-slidingClass to be set during slide animation
classes.unresolvedStringis-unresolvedUnresolved class which gets removed when initialized
disablePaginationBooleanfalseDisable pagination
enableTouchSwipeBooleantrueEnable support for swipe gestures on touch devices
groupPaginationItemsBooleantrueEnable the grouping of pagination items
infiniteBooleanfalseThe slider will be set in infinite mode. Can not be used with multiple active slide items
pageScrollThresholdNumber30Threshold for vertical swipe in pixels
paginationItemClassString'slider__pagination-list-item'Class for the generated pagination item
paginationItemJsAtomString'slider-pagination-item'Data attribute for the generated pagination item
pauseOnHoverBooleantrueWhen autoplay is set you can enable/disable pause on hover
selectors.itemsString'[data-js-item="slider-item"]'Define the slide item element
selectors.nextString'[data-js-item="slider-next"]'Define the next button element
selectors.prevString'[data-js-item="slider-prev"]'Define the prev button element
selectors.paginationListString'[data-js-item="slider-pagination-list"]'Define the pagination list element in which the pagination items are generated in
selectors.ribbonString'[data-js-item="slider-ribbon"]'Define the slider ribbon which is holding all slides and gets the full width
selectors.wrapperString'[data-js-item="slider-wrapper"]'Define the slider wrapper element
slideByItemNumberNumberfalseYou can use the option to override the initial slide step which is the number of current visible items
startAtIndexNumber0Start index for the slider
swipeThresholdNumber5Threshold for horizontal swipe in percent
visibleItemsObject{'mobile-s': 1, 'mobile-p': 1, 'tablet-p': 1, 'tablet-l': 1, 'desktop-m': 1, 'desktop-l': 1}Define how many slide items should be visible on different viewports

Sass Options

There are multiple global variables which you can change:

VariableValueDescription
$slider-darken:10 !defaultDarken value for hover effects.
$slider-unresolved-height:300px !defaultSet a fix height when the slider is in unresolved state.
$slider-duration:600ms !defaultSlide item animation duration.
$slider-ease-method:ease !defaultSlide item animation ease method.
$slider-control-bg-color:#a5cfd1 !defaultBackground color of control buttons.
$slider-pagination-color:#555 !defaultBackground color of pagination items.
$slider-pagination-color-active:$slider-pagination-color !defaultActive vackground color of pagination items which gets darken by $slider-darken.
$slider-pagination-size:15px !defaultPagination size (width & height).
$slider-pagination-border-radius:25% !defaultBorder radius of pagination items.
1.1.1

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago