I've spent quite a while looking for solutions to this, but there doesn't seem to be anything targeting what it is I'm trying to do. I'm trying to make the scrolling through my webpage 'smooth' in a sense that it is actually non-instant. I.e say a mousewheel typically moves the page up/down by 150px, I want this to be done over the course of something like 0.5s and 'ease-out' to this position.
This site here is a great example, it has a 'scrollable' container which actually scrolls by use of a transform: translate3d()
and does so over the course of a second or so to give a nice smooth feel when moving up and down the page opposed to the janky jumping of typical scrolling.
https://deanbradshaw.com/overview
I'd normally post code of what I've tried but I seriously don't know where to start except for the fact I have some container and contents like below, and want to be able to scroll through these contents in this animated/transitioned manner.
Any advice on resources which go into details about how to do this, similar questions I've missed when searching or some example code for this would be incredibly helpful.
<div class="scrollable-container">
<div class="content-list">
..
..
..
</div>
</div>
Edit For the sake of clarification, I think it's important to highlight I want to be able to control:
- The duration taken for the webpage to scroll up/down to the new offset
- The properties of this transition (linear, ease-in, ease-out, etc)
- The pixel value per mousewheeldown/up, i.e. default is 200, but I may want to set this to be only 100px per wheelup/down