Nick Faraday
Nick Faraday

Reputation: 568

Drag and Drop w/ jscrollpane dragging out of the scroll pane

Curious if anyone has added drag and drop functionality to jscrollpane?

I'm looking to drag a div (inside jscrollpane) and drop it in a div outside the jscrollpane and have it revert back to the source.

Right now with overflow hidden you can't drag outside of the jscrollpane window.

Upvotes: 2

Views: 990

Answers (1)

antriver
antriver

Reputation: 890

I had this same issue. My page consists of a list of tags on the left inside a jScrollPane and images on the rest of the page that you drag the tags to. The tags are draggables form jQuery Ui. I wasn't able to drag the tags outside the scroll pane because of the overflow:hidden that is necessary to make it work.

But here's a workaround if you're using jQuery Ui (you didn't specify): You can use a helper element and append it to the body (because it's outside the scroll pane). This creates a copy of the element and that is what you drag. This gives sufficient visual feedback to the user. I can't figure out a way to make it so you can drag the actual element, but this works:

$( ".selector" ).draggable({ 
    helper: 'clone' ,
    appendTo: 'body'
});

Upvotes: 2

Related Questions