Search code examples
javascriptjqueryjquery-uidrag-and-dropdraggable

Exclude item from handle on jQuery draggable


I have a draggable <div> with overflow set to auto to show a scrollbar when the content is too wide.

I want the entire content of the <div> to be draggable, so I have not added a handle. Now when I try to drag the scrollbar, the entire <div> is dragged instead of scrolling the content.

Is there a way of excluding an element from the handle of a draggable <div> in jQuery?

I need something like:

$("#element").draggable({
    handle: "not(#thisTable)"
})

Is there a way of doing this with selectors or something like that?


Solution

  • tnx for your answer, but i found what i think is a better solution....

    there is another option for draggable called 'cancel' and it excludes the selected element from the handle of the draggable element...

    $('#container').draggable('option', 'cancel', '#excludedElement');
    

    hope this helps someone else...