search

Home  >  Q&A  >  body text

javascript - js scroll bar implementation ideas

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中文网2795 days ago871

reply all(4)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-06-12 09:34:11

    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.

    reply
    0
  • 漂亮男人

    漂亮男人2017-06-12 09:34:11

    I wrote one a long time ago, you can just look at the link description

    reply
    0
  • 阿神

    阿神2017-06-12 09:34:11

    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

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-06-12 09:34:11

    jc scroll bar plug-in

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

    reply
    0
  • Cancelreply