Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
react-scroll-up
Advanced tools
React component to add custom button (it can be something what you want) for scroll to top of page.
Library uses requestAnimationFrame, if you want better browser compatibility (IE9 and older), you can use something like [https://gist.github.com/paulirish/1579671].
npm install react-scroll-up
You have to define children element, for example <span>UP</span>
<ScrollToTop showUnder={160}>
<span>UP</span>
</ScrollToTop>
What position (and below) the button will be displayed.
default: 0
The position to which the scrollbar be moved after clicked.
default: easeOutCubic
Type of scrolling easing. You can specify some of this type of easing: https://github.com/chenglou/tween-functions
In graphical representation: http://sole.github.io/tween.js/examples/03_graphs.html
default: 250
Time to reach the topPosition
Callback function to be called when the button is being displayed.
Callback function to be called when the button is being hidden.
default:
{
position: 'fixed',
bottom: 50,
right: 30,
cursor: 'pointer',
transitionDuration: '0.2s',
transitionTimingFunction: 'linear',
transitionDelay: '0s'
}
You can specify you own style and position of the button.
Hide/show button is based on opacity, so this styles opacity
and transitionProperty
will be all time overwrite.
If you can positioned button to left site, you have to reset css property right: 'auto'
, and similar.
FAQs
React component to render element for scroll to top of page
The npm package react-scroll-up receives a total of 7,179 weekly downloads. As such, react-scroll-up popularity was classified as popular.
We found that react-scroll-up demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.