The Vue2.0 scroll bar plug-in was not found. I wanted to use JS to implement the scroll bar. I found several JS plug-ins for scroll bar implementation on the Internet. I would like to ask if any master has written the scroll bar code manually? Or is there a related blog? No code is required, just a basic implementation idea is OK
First structure
I won’t talk about css. We need to calculate the height of the scroll bar based on the height of the content, and then ensure the movement of the content element and scroll bar after the scroll event is triggered.
For compatibility, you need to consider mousewheel and touch events, that’s basically all.
I wrote one a long time ago, you can just look at the link description
1. Do not use js to make floating object style position: fixed. But there is no floating effect.
2. Object js makes floating, object style absolute. Bind the scroll event to the object to determine the distance between the object's position and the top of the window. You can use scrollTop to move it. There are many such methods, you can look them up online
jc scroll bar plug-in
Written by myself, you can use it. If you have any questions, please contact us