We are currently trying to accomplish cross-frame dragging between draggables and sortables provided by jQuery UI. This is working properly now. However, the mouse offset seems off when dragging from the parent to the child frame--please see this fiddle: http://jsfiddle.net/r5nfe/6/.
Code in the parent:
$('#my-frame').load(function () {
$('.draggable').draggable({
appendTo: 'body',
helper: 'clone',
iframeFix: true,
revert: 'invalid',
connectToSortable: $('#my-frame').contents().find('.sortable'),
cursorAt: { top: 0, left: 0 }
});
$('#my-frame').contents().find('.sortable').sortable({
iframeFix: true,
cursorAt: { top: 0, left: 0 }
});
});
Code in the child frame:
var containers = $('.sortable');
containers.sortable({
connectWith: containers,
cursor: 'move',
revert: true,
cursorAt: { top: 0, left: 0 }
});
Can someone please tell us how to fix the mouse offset?
I've tried this for my part. But it doesn't work perfectly.
I change the
appendTo
with parent.body, and thecursorAt
with 100 on top param.solution 2 update
I added this js function because when you add too many draggable element to the iframe, the drag elements can be overlapped by the sortable elements if you scroll down
here the new jsfiddle
end solution 2 update
This problem appear to be a bug and someone have made his solution ( basically a workaround): trasparent div solution
1 My first solution, without changing the code, could be in placing the iframe before of the draggable stuff, as shown here, the code:
2 Another solution that seems to work is to play with the style property: position absolute for the ul in which contain the draggable
The iframe page:
Hope this helps.
Please see the edit at the beginning of this post