Releases: CristianDavideConte/universalSmoothScroll
Universal Smooth Scroll 6.1.0
Version 6.1.0 is out !
New Features
- the new
getWindowScrollermethod allows you to retrieve the element that scrolls the window - the new
getFramesTimemethod allows you to retrieve the value ofuss._framesTime - the new
calcFramesTimesmethod allows you to recalculate theuss._framesTimevalue - the new
containScrollparameter ofscrollXTo,scrollYTo,scrollXByandscrollYByallows you to limit the range of scrolling of a container between 0 and its maxScrollX/maxScrollY getAllScrollableParentsnow returns the same array of parents used byscrollIntoViewandscrollIntoViewIfNeededcalcXScrollbarsDimensionsnow support all instances of Element instead of only SVGElements and HTMLElementscalcYScrollbarsDimensionsnow support all instances of Element instead of only SVGElements and HTMLElementscalcScrollbarsDimensionsnow support all instances of Element instead of only SVGElements and HTMLElements- scrollable parents of Elements are now cached (10x faster)
- the new
getBrowserRefreshRatemethod of theDev-Helperslibrary allows you to retrieve the browser's fps count during testing - the same stepLengthCalculator obtained from one of the methods of the
Ease-Functionslibrary can now be used with multiple containers setStepLengthCalculatorcan now reset the default xStepLengthCalculator and yStepLengthCalculator of a container if no value is passed- the calculation time and reliability of
uss._framesTimehas 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
initparameter is passed tohrefSetup, now the propagation of the event is not stopped by default (the event is now the 3rd input parameter of theinitmethod) - the alignment of
scrollIntoViewIfNeededis 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.documentElementis nownullinstead ofwindow - API caches are now reset to
undefinedinstead ofnullafter 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
SVGElementelements are now supported- the new
Dev-Helperslibrary will help you with the more challenging aspects of the API - the
Ease-Functionslibrary now works with scroll-animations that havestillStart = false - the new
calcXScrollbarDimensionallows you to calculate the width of the vertical scrollbar of an element - the new
calcYScrollbarDimensionallows you to calculate the height of the horizontal scrollbar of an element - the new
addOnResizeCallbackfunction allows you to add a callback that will be executed only once the user has finished resizing the browser - the new
forceCalculationparameter ofgetMaxScrollXnow allows you to manually recalculate the maxScrollX value of an element, the result is returned from cache otherwise (69x faster) - the new
forceCalculationparameter ofgetMaxScrollYnow allows you to manually recalculate the maxScrollY value of an element, the result is returned from cache otherwise (69x faster) - the new
forceCalculationparameter ofgetScrollbarsMaxDimensionnow allows you to manually recalculate the_scrollbarMaxDimension, the results are returned from cache otherwise (8.3x faster) - the new
forceCalculationparameter ofcalcScrollbarsDimensionsnow allows you to manually recalculate the scrollbarsDimensions of an element, the results are returned from cache otherwise (8.3x faster) - the new
forceCalculationparameter ofcalcBordersDimensionsnow allows you to manually recalculate the bordersDimensions of an element, the result is returned from cache otherwise (6x faster) - the new
forceCalculationparameter ofgetPageScrollernow allows you to manually recalculate the_pageScroller, the result is returned from cache otherwise (6x faster) scrollIntoViewandscrollIntoViewIfNeededare now on average 6.8x faster cpu-wise and 45x faster gpu-wisehrefSetupcan now animate pages with a URL that contains a valid fragment at loadtimehrefSetupcan now update and smoothly scroll through history on Safari and IOS Safari toohrefSetupnow supports anchors that have a#in theirhref- the new
setErrorLoggerallows you to set a custom error logger - the new
setWarningLoggerallows 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.xhas 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
isXscrollinghas been renamed toisXScrollingisYscrollinghas been renamed toisYScrolling- the
jsproject directory has been renamedsrc - the
Ease-Functionslibrary is now a module - the internal constants of the API are now private
- the
calcXStepLengthandcalcYStepLengthfunctions are no longer available and they have been replaced by theDEFAULT_X_STEP_LENGTH_CALCULATORandDEFAULT_Y_STEP_LENGTH_CALCULATORconstants - the
shouldBeTestedparameter ofsetXStepLengthCalculator,setYStepLengthCalculatorandsetStepLengthCalculatoris not available anymore (moved to theDev-Helperslibrary) - whenever the history navigation is not triggered by an anchor and
updateHistory = true, theinitfunction ofhrefSetupis passednullinstead ofwindowas 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
timestampandoriginalTimestamppassed to theStepLengthCalculatorsare now the same value at the beginning of a scroll-animation - the
nearestalignment ofscrollIntoViewis now case insensitive getScrollXCalculatorandgetScrollYCalculatornow 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,setStepLengthCalculatorhave a new parameter calledshouldBeTestedthat 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
getScrollXDirectionfunction allows you to retrieve the direction of a scroll-animation on the x-axis of a container - the new
getScrollYDirectionfunction allows you to retrieve the direction of a scroll-animation on the y-axis of a container - the new
stopScrollingAllfunction 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_SPLINEease function of theuniversalsmoothscroll-ease-functionlibrary allows you to specify a canonical cubic hermite spline as the easing pattern of a scroll-animation. - the new
CUSTOM_BEZIER_CURVEease function of theuniversalsmoothscroll-ease-functionlibrary allows you to specify a n-th degree bezier curve as the easing pattern of a scroll-animation. - the new
bouncesNumberparameter ofEASE_IN_BOUNCE,EASE_OUT_BOUNCEandEASE_IN_OUT_BOUNCEof theuniversalsmoothscroll-ease-functionlibrary 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_BOUNCEinternal function of theuniversalsmoothscroll-ease-functionlibrary has been repurposed according to the newCUSTOM_CUBIC_HERMITE_SPLINEease 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
getFinalXPositionfunction allows you to retrieve the final position of a scroll-animation on the x-axis of a container - the new
getFinalYPositionfunction allows you to retrieve the final position of a scroll-animation on the y-axis of a container - the new
calcBordersDimensionsallows you to retrieve the borders' sizes of a container - the new
getAllScrollableParentsallows you to retrieve all the scrollable parents of a container - the new
updateHistoryparameter ofhrefSetupallows 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
isTemporaryparameter ofsetXStepLengthCalculator,setYStepLengthCalculatorandsetStepLengthCalculatorallows you to set a one-timeStepLengthCalculatorthat will control only the next scroll-animation StepLengthCalculatorscan 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
_debugModeand its accessors allow you to disable debug messages or to just display them unstyled scrollIntoViewandscrollIntoViewIfNeedednow takes containers' borders into considerationscrollIntoViewIfNeedednow takes scrollbars into considerationscrollIntoViewIfNeeded's callback invocation time has been greatly reducedgetXScrollableParent,getYScrollableParent,getScrollableParent,scrollIntoViewandscrollIntoViewIfNeedednow all work with containers that has the css propertyposition:fixedcalcScrollbarsDimensionsnow supports containers that hide the scrollbars through the css properties::webkit-scrollbarorscrollbar-widthscrollIntoViewandscrollIntoViewIfNeededare 20% faster than before- the
stillStartparameter now works properly in thescrollByfunction scrollIntoViewandscrollIntoViewIfNeedednow work with any amount of nested containersgetMaxScrollXandgetMaxScrollYnow work properly with thehtml, thebodyand thewindowelementscalcScrollbarDimensionsnow works properly with thehtmland thebodyelements- 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
scrollIntoViewIfNeedednow only centers the element to its closest scrollable parent instead of centering every scrollable ancestorhrefSetupnow scrolls theuss._pageScrollerto (0, 0) when the anchor's destination (href) is#getXScrollableParent,getYScrollableParentandgetScrollableParentnow returnnullif an element doesn't have a scrollable parent- a warning is now emitted whenever a
StepLengthCalculatordoesn'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
getScrollbarsMaxDimensionmethod allows you to retrieve the_scrollbarsMaxDimensionsvalue - the new
calcScrollbarsDimensionsmethod allows you to retrieve the amount of pixels occupied by an element's scrollbars scrollIntoView&scrollIntoViewIfNeedednow supports scrollbars' dimensions calculations on containers bigger than the viewport- the new
EASE_ELASTIC_Xease function of theuniversalsmoothscroll-ease-functionlibrary allows for elastic-easing-driven scroll animations on the x-axis of a container - the new
EASE_ELASTIC_Yease function of theuniversalsmoothscroll-ease-functionlibrary 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_LOGGERmessage logging - greatly improved the
DEFAULT_WARNING_LOGGERmessage 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
containerparameter now check if the corresponding received value is the window element or an HTMLElement _scrollbarDimensionis now called_scrollbarsMaxDimension- all the ease function of the
universalsmoothscroll-ease-functionlibrary now correctly respect the passed duration - the
hrefSetupmethod now stops the propagation of click events on the supported pageLinks - scroll-animations with a
finalPositionequals 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-functionlibrary 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
scrollIntoViewIfNeededmethod allows you to bring elements into the screen only when needed - added support for
nearestoption in thescrollIntoViewmethod - added a brand new API error/warning system
- the new
getXScrollableParentmethod allows you find the first scrollable parent of a container which is scrollable on the x-axis only - the new
getYScrollableParentmethod 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._pageScrollervariable - 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-functionlibrary - added support for anchors that use the
nameattribute inside thehrefSetupmethod - added support for anchors that use the
href="#"attribute inside thehrefSetupmethod - added support for the
reduceMotionfeature 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
scrollIntoViewmethod because it now indicates thenearestalignment - the default value for the input parameter
containeris nowuss._pageScrollerinstead ofwindow - stepLengthCalculator can now return numbers < 0 without triggering any internal value overlay at runtime
- element made visible with the
scrollintoViewmethod are no longer automatically focused (bugged with new chrome versions) scrollIntoViewmethod 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
getScrollableParentno longer have a default value for theelementinput parameterscrollIntoViewno longer have a default value for theelementinput 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 stepLengthCalculators 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