JSFiddle - React, Tailwind, and code Playground
HTML
<ul style="position:absolute">
<li class="draggable">Drag me</li>
<li class="draggable">Drag me 2</li>
<li class="draggable">Drag me 3</li>
</ul>
<iframe frameborder="0" id="my-frame" src="/ATu6F/30/show"></iframe>
CSS
#my-frame {
width: 100%;
height: 300px;
}
JavaScript
$('#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 }
});
});
$('.draggable').on('dragstop',autoResize);
function autoResize(){
var newheight;
if(document.getElementById){
newheight=document.getElementById('my-frame').contentWindow.document .body.scrollHeight;
}
newheight=newheight+100;
$('#my-frame').css('height',newheight);
}