Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable page scroll while dragging draggable in jquery?

I have a draggable defined this way:

$("#drag_area a").live("mouseup", function() {

    var object = $(this);
    var class_array = $(this).attr("class").split(" ");
    element(object,class_array);
    return false;

}).draggable({
    containment: "#drag_area",
    grid: [44, 44],
    zIndex: 1000
}).each(function(i, item){    
});

When i drag an item of the type 'drag_area a', if i scroll the page while dragging it, the item exits from containment... It is not a desidered situation, so how can i avoid this? Can i disable page scrolling during dragging?

like image 358
Sasha Grievus Avatar asked Sep 04 '15 10:09

Sasha Grievus


1 Answers

I solved that problem with one line of css on dragging element touch-action: none;

like image 149
KaZe Avatar answered Nov 05 '22 04:11

KaZe