How to scroll when cursor is on the edge of div?

后端 未结 3 1923
陌清茗
陌清茗 2021-01-15 21:24

I have a div(menubar) that has a lot of links and these links are out of the view. I must make the div scroll to the right or left when the cursor is at the edge of the menu

相关标签:
3条回答
  • 2021-01-15 22:06

    Take a look at this example, in this example you can see how they scroll the div when the mouse at right edge of the div. you can do the same thing.

    How to Auto Scroll a div on mouse move over the margins?

    0 讨论(0)
  • 2021-01-15 22:06

    Here Answer

    <div onmouseover="this.className='addscrool'"    onmouseout="this.className='removescrool';" style="width:100px;height:100px;border:1px  solid Blue">
     </div>
     <style>
    .addscrool
    {
    overflow-y: scroll;
    }   .removescrool
    {
    overflow-y:hidden ;
     }         
    

    0 讨论(0)
  • 2021-01-15 22:17

    Short:

    Use-ready solutions:

    • Scrolling-carousel
    • Jmycarousel (demo)
    • Smooth div scroll

    Full answers you can read on relative questions:

    • jQuery plugin to continually horizontally scroll on mouseover
    • Looking for jQuery plugin (or code) to automatically scroll Carousel items on mousover
    0 讨论(0)
提交回复
热议问题