Universal Smooth Scroll 5.0.0
CristianDavideConte
released this
18 Dec 17:36
·
364 commits
to master
since this release
Version 5.0 is out !
New Features
- the new
getFinalXPosition
function allows you to retrieve the final position of a scroll-animation on the x-axis of a container - the new
getFinalYPosition
function allows you to retrieve the final position of a scroll-animation on the y-axis of a container - the new
calcBordersDimensions
allows you to retrieve the borders' sizes of a container - the new
getAllScrollableParents
allows you to retrieve all the scrollable parents of a container - the new
updateHistory
parameter ofhrefSetup
allows you to update the browser's history whenever an anchor is clicked and to support automatic smooth-scrolling between fragments when the user navigates through the history - the new
isTemporary
parameter ofsetXStepLengthCalculator
,setYStepLengthCalculator
andsetStepLengthCalculator
allows you to set a one-timeStepLengthCalculator
that will control only the next scroll-animation StepLengthCalculators
can now be dynamically changed even when there's a scroll-animation happening- it is now possible to initiate a scroll-animation from inside a
StepLengthCalculator
- it is now possible to stop a scroll-animation from inside a
StepLengthCalculator
- the new
_debugMode
and its accessors allow you to disable debug messages or to just display them unstyled scrollIntoView
andscrollIntoViewIfNeeded
now takes containers' borders into considerationscrollIntoViewIfNeeded
now takes scrollbars into considerationscrollIntoViewIfNeeded
's callback invocation time has been greatly reducedgetXScrollableParent
,getYScrollableParent
,getScrollableParent
,scrollIntoView
andscrollIntoViewIfNeeded
now all work with containers that has the css propertyposition:fixed
calcScrollbarsDimensions
now supports containers that hide the scrollbars through the css properties::webkit-scrollbar
orscrollbar-width
scrollIntoView
andscrollIntoViewIfNeeded
are 20% faster than before- the
stillStart
parameter now works properly in thescrollBy
function scrollIntoView
andscrollIntoViewIfNeeded
now work with any amount of nested containersgetMaxScrollX
andgetMaxScrollY
now work properly with thehtml
, thebody
and thewindow
elementscalcScrollbarDimensions
now works properly with thehtml
and thebody
elements- the default constant values of the API now scales with the browser's window resolution
- the documentation is now divided into navigable sections and it's more informative
- bugfixes and performance improvements
Changes compared to the previous version
scrollIntoViewIfNeeded
now only centers the element to its closest scrollable parent instead of centering every scrollable ancestorhrefSetup
now scrolls theuss._pageScroller
to (0, 0) when the anchor's destination (href) is#
getXScrollableParent
,getYScrollableParent
andgetScrollableParent
now returnnull
if an element doesn't have a scrollable parent- a warning is now emitted whenever a
StepLengthCalculator
doesn't return a valid stepLength during a scroll-animation
IMPORTANT NOTE
Universal Smooth Scroll 5.0.0
is a major release of the API and it may not work out-of-the-box with existing Universal Smooth Scroll 4.x.x
projects.
I suggest you to check the return value of getXScrollableParent
, getYScrollableParent
and getScrollableParent
functions that you invoked on containers that may not have a scrollable parent, because the return value is now null
instead of window
.
I also suggest you to check if the new scrollIntoView
and scrollIntoViewIfNeeded
behave as you expect on containers that have scrollabars/borders.
For any bug or feature request don't hesitate to contact me.
Happy holidays 🎅🎆