Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript (jQuery) disable page scroll when dragging items

I have a widget-like system with widgets that are able to be dragged around (with jQuery draggable/sortable). The problem is now that when a user drags one of those widgets and moves the cursor on the edge, the parent div scrolls to the direction of the cursor.

A simplified layout is as follows:

<div id="wrapper" style="width:WINDOW_WIDTH;">
  <div id="page_wrapper" style="width:10000px;">
    <div class="widget_page" style="width:WINDOW_WIDTH;">
      <div class="widget draggable"></div>
      <div class="widget draggable"></div>
      <div class="widget draggable"></div>
    </div>        
    <div class="widget_page" style="width:WINDOW_WIDTH;">
      <div class="widget draggable"></div>
      <div class="widget draggable"></div>
      <div class="widget draggable"></div>
    </div>
  </div>
</div>

is there any way i can disable the page_wrapper from scrolling?

like image 996
Bart Zweers Avatar asked Feb 07 '12 12:02

Bart Zweers


1 Answers

Try to add overflow:hidden; in the css of the page_wrapper.

like image 102
Mike Avatar answered Oct 15 '22 03:10

Mike