All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
2.0.3 - 2021-10-26
- Fix iOS 15 resize events causing scroll jank by replacing
window.resize
withResizeObserver
in supported browsers. - Fix iOS 15 blue button colors in demo styles.
- Fix incorrect test values for nested slider scroll position.
- Upgrade to HTTPS npm registry.
- Update
package-lock.json
with quick dependency updates. - Recommend "scrollfix" hack to fix browsers removing the outer margin / padding from scrollable overflow areas.
2.0.2 - 2020-08-11
- Remove leftover
console.log()
from the v2.0.1 align bugfix.
2.0.1 - 2020-08-11
- Fix
data-snap-slider-align
overriding normal CSS behavior. Instead, leave the attribute blank by default. Only apply it when the slide's CSS snap align is eithernone
, blank, or unsupported.
2.0.0 - 2020-08-10
- Add build process.
- Multiple builds: full, lite, and minified versions of each.
- Cypress tests.
- More robust browser support.
- Add
package-lock.json
. - New event callbacks:
load
,change
,change.click
,change.scroll
,change.keydown
,change.focusin
,scroll
,scroll.start
,scroll.end
. - New instance methods:
getSlide()
,getCurrentSlide()
,goto()
,addNav()
,addGotoButtons()
,update()
,reset()
,destroy()
,on()
. - New static methods:
SnapSlider.get()
,SnapSlider.debug()
. - Attach
SnapSlider
prop to DOM elements for easy access. - Debugger for easier development.
- Auto-init sliders with
data-snap-slider
attributes on page load (instead of requiring JS initialization). - Replace JSON object syntax. Now
data-snap-slider
only defines the slider ID, and each option has its own data attribute. - Rename
initial
option tostart
. Use thedata-snap-slider-start
attribute instead. - Change default start slide from
middle
to1
. Usedata-snap-slider-start="middle"
to keep the v1 start position. - Rename
items
option toslides
. Use thedata-snap-slider-slides
attribute to define custom slides. - Remove
off
option. Responsive changes should be entirely handled by CSS now. - Replace
arrows
andpagination
options with thedata-snap-slider-nav
attribute. Instead of targeting navigation elements from the slider, tell nav elements what slider to target. - Remove
arrows
andpagination
properties fromSnapSlider
instances. - Make
current
slide index 1-index instead of 0-index. - Rename
items
property toslides
. - Remove
previous
property fromSnapSlider
instances. - Rename
goTo
to all lowercasegoto()
. - Change
goto()
second parameterimmediately
to an objectoptions
. For example,goTo(1, true)
becomesgoto(2, { immediate: true })
. - Improve docs with better getting started notes & examples.
- Move starter CSS to demos.
- Fix slider
change
events firing multiple times per transition. Now change events should only fire once, until the next change fires. - Fix misc
package.json
errors (e.g., incorrect bugs URL).
- Use ES5 syntax so script works in IE by default.
- Hide scrollbar in IE with
-ms-overflow-style: -ms-autohiding-scrollbar;
- Fix missing styles/scripts in demo
index.html
. - Fix pagination classes missing is-current class because this.current was undefined
- Add readme with getting started instructions and examples.
- Add changelog.
- Add linting and formatting tools.
- Fix
window.matchMedia(this.options.off)
failing in IE whenoff
is an empty string (like for sliders that are always active). - Always add
resizeHandler
so it still slides to the active slide on resize, even if there's nooff
option defined.
- Fixed
getClosest
breaking in Edge and IE becausegetBoundingClientRect
doesn’t return contain x and y properties. 🙃
- Change
vw
units to%
since, you know, percentages work and support older browsers. - Move smoothscroll-polyfill to JS panel so it's easier to copy/paste from CodePen into new projects.
- Automatically detect
items
(use children by default).- If you want to include other non-slide elements in your slider, you can still use the
items
option to specify which elements should be used as items.
- If you want to include other non-slide elements in your slider, you can still use the
options
param for initializing SnapSlider from JavaScript.
- Allow
container
param to be Element, string, or any array-like object (NodeList, jQuery, etc.). - Replace
Array.from
polyfill withqsa
helper usingArray.prototype.slice.call()
.
- Remove
console.log
fromupdateNavigation
. - Remove unused
margin
option.
- Add JavaScript hooks for CSS-only sliders.
- Use
on
method to add events on slide changes. - Configure slider settings with HTML attribute
data-snap-slider
. - Add option for slider arrow buttons.
- Add option for slider pagination buttons.
- Center slider items by default.
- Update slider on scroll and window resize.
- Use
off
param to toggle slider at a media query. - Change items on click and focus for keyboard accessibility.
- CSS falls back to simple
overflow: scroll
section.