javascript - js scroll bar implementation ideas
PHP中文网
PHP中文网 2017-06-12 09:32:11
0
4
840

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

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(4)
过去多啦不再A梦

First structure

<p class="wrapper">//包裹
  <p class="content">
    //内容
 </p>
</p>

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

过去多啦不再A梦

jc scroll bar plug-in

Written by myself, you can use it. If you have any questions, please contact us

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template