Skip to content

v2.5.0 — Multiple slides possible

Compare
Choose a tag to compare
@barthy-koeln barthy-koeln released this 12 May 10:57
· 61 commits to main since this release

This release allows having slides that are smaller than the slider itself.

Feature: Sizing method

By default, the first slide's offsetWidth is used to calculate everything. Override this method to change the slider's behavior.

/**
 * @callback sizingMethod
 * @param {ScrollSnapSlider} slider
 * @return {Number} integer size of a slide in pixels
 */

/**
 * Width of each slide
 * @type {sizingMethod}
 * @public
 */
this.sizingMethod = function (slider) {
  return slider.element.firstElementChild.offsetWidth
}