A slider based on the hylo-drag-area component and its snap feature.

Use hylo-snap-slider-item components to define the items of the slider. Place them inside this component.

Used slots:

  • default: for hylo-snap-slider-item components
  • previous: the content of the previous element
  • next: the content of the next element

Properties

addShortcuts: boolean

Adds shortcuts/jumpmarker for keyboard usage.

animationInterval: number = 10

The interval in milliseconds in which the animation jumps from one item to the next when scrolling (showing previous or next items).

contentClass: string = ''

Classes added to the content element which holds the hylo-snap-slider-item components.

dragAreaClass: string = ''

Classes added to the used hylo-drag-area component.

dragAreaContentClass: string = ''

Classes added to the content element of the hylo-drag-area component. The hylo-drag-area content element wraps the content element of this component.

dragInterval: number = 500

The interval in milliseconds which differentiate between a drag and a click event. If a drag is longer than the value, the click event is stopped from bubbling up.

scrollbarClass: string = ''

Classes added to the hylo-scrollbar component.

scrollbarTouch: string | boolean

Defines whether the scrollbar listens to touch events. Can be set as boolean or as a comma separated string of breakpoints (hylo-breakpoint-listener needed).

scrollbarWrapperClass: string = ''

Classes added to the element which wraps the hylo-scrollbar and hylo-drag-area component. Add bottom padding to adjust the scrollbar position.

shortcutsInterval: number = 10

After how many hylo-snap-item(s) should a shortcut be placed. Inactive items are not counted.

showPrevNext: boolean

Adds unstyled elements with the class "hylo-snap-slider-previous" and "hylo-snap-slider-next" before and after the drag area respectively. You can place additional markup into the elements by using the slots "previous" and "next". You are in charge of positioning and styling them correctly.

The previous and next element are linked to the show previous and next items functionality.

showScrollbar: boolean

Shows a scrollbar. Hides the scrollbar if nothing is to scroll.

Methods

  • Returns the HTMLElement which holds the hylo-snap-slider-item components. Can be used to add hylo-snap-slider-item components programmatically.

    Returns Promise<HTMLElement>

  • Returns the used hylo-drag-area component. Can be used to add further functionality.

    Returns Promise<HTMLHyloDragAreaElement>

  • Shows the next items.

    Returns Promise<void>

  • Shows the previous items.

    Returns Promise<void>

  • Updates the component. Needs to be called when changes in the styling or dimensions occured which lead to different snap points or the content changed -> hylo-snap-slider-item components where added or removed.

    Returns Promise<void>

  • Updates the shortcuts. Needs to be called when hylo-snap-slider-item components where added or removed.

    Returns Promise<void>

Events

hyloSnapSliderClicked: EventEmitter<CustomEvent<any>>

Fires when on of its hylo-snap-slider-item components fired hyloSnapSliderItemClicked. Returns the fired hyloSnapSliderItemClicked event.

Generated using TypeDoc