Skip to content

Universal Smooth Scroll 5.0.0

Compare
Choose a tag to compare
@CristianDavideConte 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 of hrefSetup 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 of setXStepLengthCalculator, setYStepLengthCalculator and setStepLengthCalculator allows you to set a one-time StepLengthCalculator 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 and scrollIntoViewIfNeeded now takes containers' borders into consideration
  • scrollIntoViewIfNeeded now takes scrollbars into consideration
  • scrollIntoViewIfNeeded 's callback invocation time has been greatly reduced
  • getXScrollableParent, getYScrollableParent, getScrollableParent, scrollIntoView and scrollIntoViewIfNeeded now all work with containers that has the css property position:fixed
  • calcScrollbarsDimensions now supports containers that hide the scrollbars through the css properties ::webkit-scrollbar or scrollbar-width
  • scrollIntoView and scrollIntoViewIfNeeded are 20% faster than before
  • the stillStart parameter now works properly in the scrollBy function
  • scrollIntoView and scrollIntoViewIfNeeded now work with any amount of nested containers
  • getMaxScrollX and getMaxScrollY now work properly with the html, the body and the window elements
  • calcScrollbarDimensions now works properly with the html and the body 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 ancestor
  • hrefSetup now scrolls the uss._pageScroller to (0, 0) when the anchor's destination (href) is #
  • getXScrollableParent, getYScrollableParent and getScrollableParent now return null 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 🎅🎆

Cristian Davide Conte