Adds a scroll to top button at the bottom right of the page when scrolled to the bottom, and hides it at the top.
Dynamic Content Awareness
Advanced Smooth Scrolling
easeInOutCubic: Balanced acceleration/decelerationeaseOutQuad: Natural decelerationeaseInOutExpo: Dramatic easing for long scrollsIntelligent Visibility Control
Event Handling
Memory Management
{
buttonSize: '40px',
fontSize: '16px',
backgroundColor: '#333',
hoverColor: '#444',
textColor: '#FFF',
borderRadius: '50%',
bottom: '20px',
right: '20px'
}
{
scroll: {
duration: 800, // Base duration in milliseconds
easing: 'easeInOutCubic',
fps: 60,
breakpoints: {
short: 500, // Quick scroll for short distances
medium: 1500, // Standard scroll for medium distances
long: 3000 // Slower scroll for long distances
}
}
}
{
showThreshold: 300, // Pixels scrolled before showing
minimumPageHeight: 1000, // Minimum page height to enable button
fadeSpeed: 300, // Transition duration
zIndex: 2147483647 // Maximum z-index value
}
The script uses a sophisticated animation system that: