Embla Carousel v2.9.1 Release Notes
Release Date: 2020-04-21 // almost 4 years ago-
๐ฑ ๐ New features
๐ This release comes with more tools to manipulate the carousels
scrollProgress
.โ Additions to
scrollProgress
It's now possible to get the scroll progress of either the carousels current scroll location or its target scroll location. Get the scroll progress of the carousels current scroll location:
embla.scrollProgress()
Get the scroll progress of the carousels target scroll location
const target = trueembla.scrollProgress(target)
โ Additions to
scrollBy
It's now possible to pass a second
boolean
parameter if you want the carousel to snap to the closest snap position. Passingtrue
will snap the carousel whilefalse
will scroll by the exact given amount.const snapToClosest = trueembla.scrollBy(0.2, snapToClosest)
๐ New feature
scrollToProgress
As discussed in issue #26 this feature allows for setting the absolute scroll progress directly as compared to
scrollBy
which adds to the current scroll progress. LikescrollBy
, it also accepts a secondboolean
parameter if you want the carousel to snap to the closest snap position. Passingtrue
will snap the carousel whilefalse
will scroll to the exact given progress.const snapToClosest = trueembla.scrollToProgress(0.2, snapToClosest)
Thanks a bunch @xiel for this feature request.
๐ฑ Enjoy ๐!