Search code examples
jquery-uiscrollbarselectablejquery-ui-selectable

jQuery UI selectable and scrollbar


I have a div with divs inside. The outer one has overflow-y: auto;, so with many internal items the right scrollbar appears. After doing $('#container').selectable(); when I press left mouse button over the scrollbar, it doesn't scroll, but a dotted frame for selecting is shown.

I have found this solution: JQuery UI Selectable plugin: Make scroll bar not selectable when div overflows

Unfortunately, it doesn't work for me, because when I scroll to the bottom, the items stop being selectable. (Though the top ones continue). So, the question is: how make the scrollbar... mmm... a scrolling bar, without splitting the container into 2 divs.


Solution

  • Use a wrapper div for this , Its working fine for me.

    .selectable-wrapper {  border-radius: 5px; min-height: 200px;  max-height: 200px;  overflow-y: auto; border: 1px solid #D1D1D1;}
    
    .selectable { list-style-type: none;padding: 5px;}
    <div class="selectable-wrapper">
      <ul class="selectable">
    
      </ul>
    </div>