There are several websites where I see smooth slow scrolling. I have been looking for plugins for react or vue. I basically want to learn how to do it with vanilla Javascript. Also you can suggest plugins libraries and whatever you want. But I want to know how to do it in pure vanilla js. I want to learn to control scroll speed.
here are the websites:
- /
you can tell me what these websites are using also tell me how to do it using pure js.
There are several websites where I see smooth slow scrolling. I have been looking for plugins for react or vue. I basically want to learn how to do it with vanilla Javascript. Also you can suggest plugins libraries and whatever you want. But I want to know how to do it in pure vanilla js. I want to learn to control scroll speed.
here are the websites:
- https://nana-asia./
- https://pelizzari./en
- https://loerarchitecten./en/projects/republica-short-guy
you can tell me what these websites are using also tell me how to do it using pure js.
Share Improve this question asked Apr 20, 2020 at 9:29 Maisha MalihaMaisha Maliha 671 gold badge1 silver badge8 bronze badges 2- 1 See this question here: stackoverflow./questions/47011055/… – Enchew Commented Apr 20, 2020 at 9:36
- I was literaly looking for it for so long – Kabeer Jaffri Commented May 5, 2021 at 21:11
2 Answers
Reset to default 2One approach:
Catch the mousewheel and touch events and prevent their orignal behaviour.
Detect direction and speed of touch events or scroll amount for mousewheel events
Use the event values and map those to the desired scroll level
Apply a CSS translate to your page content
If you want the page to scroll smoothly like the first like here is a good plugin https://jokertattoo.co.uk/js/SmoothScroll.js You can mess around with these values till you get a result you want:
frameRate : 150, // [Hz]
animationTime : 2000, // [px]
stepSize : 150, // [px]
and here is a demo of it in action: https://ui-unicorn.co.uk/my-cv/
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742416350a4439815.html
评论列表(0条)