Releases: CristianDavideConte/universalSmoothScroll
Universal Smooth Scroll 6.1.0
Version 6.1.0 is out !
New Features
- the new
getWindowScroller
method allows you to retrieve the element that scrolls the window - the new
getFramesTime
method allows you to retrieve the value ofuss._framesTime
- the new
calcFramesTimes
method allows you to recalculate theuss._framesTime
value - the new
containScroll
parameter ofscrollXTo
,scrollYTo
,scrollXBy
andscrollYBy
allows you to limit the range of scrolling of a container between 0 and its maxScrollX/maxScrollY getAllScrollableParents
now returns the same array of parents used byscrollIntoView
andscrollIntoViewIfNeeded
calcXScrollbarsDimensions
now support all instances of Element instead of only SVGElements and HTMLElementscalcYScrollbarsDimensions
now support all instances of Element instead of only SVGElements and HTMLElementscalcScrollbarsDimensions
now support all instances of Element instead of only SVGElements and HTMLElements- scrollable parents of Elements are now cached (10x faster)
- the new
getBrowserRefreshRate
method of theDev-Helpers
library allows you to retrieve the browser's fps count during testing - the same stepLengthCalculator obtained from one of the methods of the
Ease-Functions
library can now be used with multiple containers setStepLengthCalculator
can now reset the default xStepLengthCalculator and yStepLengthCalculator of a container if no value is passed- the calculation time and reliability of
uss._framesTime
has been greatly improved (from a few seconds down to 33ms at most) - improved parsing of default error/warning loggers for values that are not instances of Element
- bugfixes and performance improvements
Changes compared to the previous version
- if the
init
parameter is passed tohrefSetup
, now the propagation of the event is not stopped by default (the event is now the 3rd input parameter of theinit
method) - the alignment of
scrollIntoViewIfNeeded
is now always applied, even if the passed element is already into view - regexes used by the API are now global constants
- the scrollable parent of
document.documentElement
is nownull
instead ofwindow
- API caches are now reset to
undefined
instead ofnull
after a resize event
Here you can find the full Universal Smooth Scroll 6.1.0
project: https://github.com/users/CristianDavideConte/projects/1
For any bug or feature request don't hesitate to contact me.
Have a nice day :)
Cristian Davide Conte
Universal Smooth Scroll 6.0.0
Version 6.0 is out !
New Features
- mobile browsers are supported again
SVGElement
elements are now supported- the new
Dev-Helpers
library will help you with the more challenging aspects of the API - the
Ease-Functions
library now works with scroll-animations that havestillStart = false
- the new
calcXScrollbarDimension
allows you to calculate the width of the vertical scrollbar of an element - the new
calcYScrollbarDimension
allows you to calculate the height of the horizontal scrollbar of an element - the new
addOnResizeCallback
function allows you to add a callback that will be executed only once the user has finished resizing the browser - the new
forceCalculation
parameter ofgetMaxScrollX
now allows you to manually recalculate the maxScrollX value of an element, the result is returned from cache otherwise (69x faster) - the new
forceCalculation
parameter ofgetMaxScrollY
now allows you to manually recalculate the maxScrollY value of an element, the result is returned from cache otherwise (69x faster) - the new
forceCalculation
parameter ofgetScrollbarsMaxDimension
now allows you to manually recalculate the_scrollbarMaxDimension
, the results are returned from cache otherwise (8.3x faster) - the new
forceCalculation
parameter ofcalcScrollbarsDimensions
now allows you to manually recalculate the scrollbarsDimensions of an element, the results are returned from cache otherwise (8.3x faster) - the new
forceCalculation
parameter ofcalcBordersDimensions
now allows you to manually recalculate the bordersDimensions of an element, the result is returned from cache otherwise (6x faster) - the new
forceCalculation
parameter ofgetPageScroller
now allows you to manually recalculate the_pageScroller
, the result is returned from cache otherwise (6x faster) scrollIntoView
andscrollIntoViewIfNeeded
are now on average 6.8x faster cpu-wise and 45x faster gpu-wisehrefSetup
can now animate pages with a URL that contains a valid fragment at loadtimehrefSetup
can now update and smoothly scroll through history on Safari and IOS Safari toohrefSetup
now supports anchors that have a#
in theirhref
- the new
setErrorLogger
allows you to set a custom error logger - the new
setWarningLogger
allows you to set a custom warning logger - calling a setter with no argument now resets the corresponding variable to its default value
- support for
UniversalSmoothScroll 2.x
has been dropped - the API functionalities are now automatically tested with
Cypress
- greatly improved default error and warning loggers
- bugfixes and performance improvements
Changes compared to the previous version
isXscrolling
has been renamed toisXScrolling
isYscrolling
has been renamed toisYScrolling
- the
js
project directory has been renamedsrc
- the
Ease-Functions
library is now a module - the internal constants of the API are now private
- the
calcXStepLength
andcalcYStepLength
functions are no longer available and they have been replaced by theDEFAULT_X_STEP_LENGTH_CALCULATOR
andDEFAULT_Y_STEP_LENGTH_CALCULATOR
constants - the
shouldBeTested
parameter ofsetXStepLengthCalculator
,setYStepLengthCalculator
andsetStepLengthCalculator
is not available anymore (moved to theDev-Helpers
library) - whenever the history navigation is not triggered by an anchor and
updateHistory = true
, theinit
function ofhrefSetup
is passednull
instead ofwindow
as the anchor - if an error is thrown by a custom
StepLengthCalculator
, the API no longer catches it - all the callbacks passed to the API functions are now executed in the same frame the scroll-animations end
- the
timestamp
andoriginalTimestamp
passed to theStepLengthCalculators
are now the same value at the beginning of a scroll-animation - the
nearest
alignment ofscrollIntoView
is now case insensitive getScrollXCalculator
andgetScrollYCalculator
now immediately report any error that occurs instead of passing a functions that throws it when invoked- the default values of every API function is now explicitly stated inside the docs
- mandatory API functions' parameters are now in bold inside the docs
- optional API functions' parameters are now in italic inside the docs
Here you can find the full Universal Smooth Scroll 6.0.0
project: https://github.com/CristianDavideConte/universalSmoothScroll/projects/2
IMPORTANT NOTE
Universal Smooth Scroll 6.0.0
is a major release of the API and it may not work out-of-the-box with existing Universal Smooth Scroll 5.x.x
projects.
The Ease-Functions
library is now a module so you have to manually import the ease-functions you're using in your project.
I would also suggest you to check all the functions that now cache their results to make sure you're getting what you expect.
For any bug or feature request don't hesitate to contact me.
Have a nice day :)
Cristian Davide Conte
Universal Smooth Scroll 5.1.2
New Features
setXStepLengthCalculator
,setYStepLengthCalculator
,setStepLengthCalculator
have a new parameter calledshouldBeTested
that allows you to test if the passed function is a validStepLengthCalculator
- bugfixes and performance improvements
Universal Smooth Scroll 5.1.1
Bugfixes and performance improvements
Universal Smooth Scroll 5.1.0
Version 5.1.0 is out !
New Features
- the new
getScrollXDirection
function allows you to retrieve the direction of a scroll-animation on the x-axis of a container - the new
getScrollYDirection
function allows you to retrieve the direction of a scroll-animation on the y-axis of a container - the new
stopScrollingAll
function allows you to stop all the current scroll-animations on both the x and y axes of all the containers - the new
CUSTOM_CUBIC_HERMITE_SPLINE
ease function of theuniversalsmoothscroll-ease-function
library allows you to specify a canonical cubic hermite spline as the easing pattern of a scroll-animation. - the new
CUSTOM_BEZIER_CURVE
ease function of theuniversalsmoothscroll-ease-function
library allows you to specify a n-th degree bezier curve as the easing pattern of a scroll-animation. - the new
bouncesNumber
parameter ofEASE_IN_BOUNCE
,EASE_OUT_BOUNCE
andEASE_IN_OUT_BOUNCE
of theuniversalsmoothscroll-ease-function
library allows you to freely choose the number of bounces of these ease functions. - greatly improved the API memory management
- bugfixes and performance improvements
Changes compared to the previous version
- the error messages can now show up to 40 character instead of 30
- the error messages are now much more informative
- the stack trace of error and warning messages is now collapsed by default
- a warning message is now emitted if the API is requested to scroll a container that is not scrollable on that axis
- the
_CUSTOM_BOUNCE
internal function of theuniversalsmoothscroll-ease-function
library has been repurposed according to the newCUSTOM_CUBIC_HERMITE_SPLINE
ease function
IMPORTANT NOTE
On NPM this version is tagged as 5.1.0-s
, but it's the same version.
For any bug or feature request don't hesitate to contact me.
Have a nice day :)
Cristian Davide Conte
Universal Smooth Scroll 5.0.0
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 🎅🎆
Cristian Davide Conte
Universal Smooth Scroll 4.1.0
Version 4.1.0 is out !
New Features
- the new
getScrollbarsMaxDimension
method allows you to retrieve the_scrollbarsMaxDimensions
value - the new
calcScrollbarsDimensions
method allows you to retrieve the amount of pixels occupied by an element's scrollbars scrollIntoView
&scrollIntoViewIfNeeded
now supports scrollbars' dimensions calculations on containers bigger than the viewport- the new
EASE_ELASTIC_X
ease function of theuniversalsmoothscroll-ease-function
library allows for elastic-easing-driven scroll animations on the x-axis of a container - the new
EASE_ELASTIC_Y
ease function of theuniversalsmoothscroll-ease-function
library allows for elastic-easing-driven scroll animations on the y-axis of a container - rubber band scrolling effect is now supported
- greatly improved the
DEFAULT_ERROR_LOGGER
message logging - greatly improved the
DEFAULT_WARNING_LOGGER
message logging - the DEMO has been updated to showcase the new rubber band effect
- several performance optimizations + bug fixes + code cleanup
Changes compared to the previous version
- all the API methods that require a
container
parameter now check if the corresponding received value is the window element or an HTMLElement _scrollbarDimension
is now called_scrollbarsMaxDimension
- all the ease function of the
universalsmoothscroll-ease-function
library now correctly respect the passed duration - the
hrefSetup
method now stops the propagation of click events on the supported pageLinks - scroll-animations with a
finalPosition
equals to the current position of the container will now stop the current scroll-animation - errors generated inside of an ease function of the
universalsmoothscroll-ease-function
library now shows the correct ease function name
Universal Smooth Scroll 4.0.2
scrollIntoView
&& scrollIntoViewIfNeeded
methods now correctly calculate the scrollbars dimensions.
Bugfixes + performance optimizations.
Universal Smooth Scroll 4.0.1
Bugfixes and performance optimizations + DEFAULT_MIN_ANIMATION_FRAMES is now 60.
Universal Smooth Scroll 4.0.0
Version 4.0 is out !
New Features
- the new
scrollIntoViewIfNeeded
method allows you to bring elements into the screen only when needed - added support for
nearest
option in thescrollIntoView
method - added a brand new API error/warning system
- the new
getXScrollableParent
method allows you find the first scrollable parent of a container which is scrollable on the x-axis only - the new
getYScrollableParent
method allows you find the first scrollable parent of a container which is scrollable on the y-axis only - the default document scrolling element can now be set through the new
uss._pageScroller
variable - ease functions now support callbacks that are executed at each scroll step
- added support for custom bounce-scrolling ease functions
- new bounce-scrolling ease functions are provided in the
universalsmoothscroll-ease-function
library - added support for anchors that use the
name
attribute inside thehrefSetup
method - added support for anchors that use the
href="#"
attribute inside thehrefSetup
method - added support for the
reduceMotion
feature on Safari older than version 14
Changes compared to the previous version
- the string "nearest" can no longer be used to center items with the
scrollIntoView
method because it now indicates thenearest
alignment - the default value for the input parameter
container
is nowuss._pageScroller
instead ofwindow
- stepLengthCalculator can now return numbers < 0 without triggering any internal value overlay at runtime
- element made visible with the
scrollintoView
method are no longer automatically focused (bugged with new chrome versions) scrollIntoView
method now takes the scrollbar dimensions into consideration for the scroll amount- the API now uses
strict mode
- the DEMO now uses a less resource-intensive theme
getScrollableParent
no longer have a default value for theelement
input parameterscrollIntoView
no longer have a default value for theelement
input parameter- fixed the DEMO's behavior on Firefox and Safari.
IMPORTANT NOTE
universalSmoothScroll 4.0.0
is a Major release and it may not work out-of-the-box with existing universalSmoothScroll 3.x.x
based projects.
I suggest you to update the signature of your getScrollableParent
and scrollIntoView
if you used the default parameters (which were doing basically nothing).
I also suggest you to check the behavior of those particular stepLengthCalculator
s that used to return a value < 0 relying on the fact that the API was resetting it to the default value at runtime, because it will be different (they will now force the scroll animation to invert its direction).
For any bug or feature request don't hesitate to contact me.
Have a nice day :)
Cristian Davide Conte