I have a jquery ui interface with draggable elements that, when dragged, only auto scrolls the main window, instead of the Sortable div container.
I have tried so many things it would take hours to append them all to this post.
Is there any reliable way to force a sortable div to auto scroll when a non-child draggable element is in the sortable section?
DRAGGABLE AND SORTABLE/DROPPABLE'S HTML:
<div class="objectPaletteHolder">
<ul>
<li id="draggable" class="ui-state-highlight">
<table class="subObjectTable">
<tr><td class="objectName" colspan="5">Title</td></tr>
<tr><td class="rightAlign">Text: </td><td colspan="4"><input type="text" maxlength="500" name="titleValue" /></td></tr>
<tr><td class="rightAlign">Alignment: </td><td><input type="radio" class="titleAlignmentLeft" name="titleAlignment" value="left" /></td><td><input type="radio" class="titleAlignmentCenter" name="titleAlignment" value="center" checked="checked" /></td><td><input type="radio" class="titleAlignmentRight" name="titleAlignment" value="right" /></td><td><input type="radio" class="titleAlignmentJustify" name="titleAlignment" value="justify" /></td></tr>
<tr><td></td><td class="smallText">Left</td><td class="smallText">Center</td><td class="smallText">Right</td><td class="smallText">Justify</td></tr>
</table>
</li>
<li id="draggable2" class="ui-state-highlight">Paragraph</li>
<li id="draggable2" class="ui-state-highlight">Link</li>
<li id="draggable2" class="ui-state-highlight">Image-Link</li>
<li id="draggable2" class="ui-state-highlight click">Line-Break</li>
</ul>
<ul>
<li id="draggable" class="ui-state-highlight">Sub-Title</li>
<li id="draggable2" class="ui-state-highlight">Text</li>
<li id="draggable2" class="ui-state-highlight">Image</li>
<li id="draggable2" class="ui-state-highlight">Bullet-Line</li>
</ul>
</div>
<div class="editContainer">
<ul id="sortable">
<li class="ui-state-default">Item 1</li>
<li class="ui-state-default">Item 2</li>
<li class="ui-state-default">Item 3</li>
<li class="ui-state-default">Item 4</li>
<li class="ui-state-default">Item 5</li>
</ul>
</div>
<br/><br/>
VALID JQUERY:
jQuery(function ($) {
//DRAG, DROP, AND SORTABLE CODE *START*//
$("#sortable").sortable({
revert: true,
receive: function (event, ui) {
},
change: function (event, ui) {
//Place code that triggers on the sortable list being changed here.
//Note, DO NOT allow alerts in this function. It breaks the dragging/dropping fluidity.
}
}).droppable({});
$("#draggable, #draggable2").draggable({
connectToSortable: "#sortable",
helper: "clone",
revert: "invalid"
});
$("ul, li").disableSelection();
//DRAG, DROP, AND SORTABLE CODE *END*//
});
FULL JSFIDDLE:
TO HELP CLARIFY:
When the Sortable list grows too large the vertical scrollbar becomes active, of course, and if dragging an element that originated within the sortable container, it auto-scrolls just fine. However, I want it to autoscroll, when an outside draggable element is within the sortable container, as well. It used to have this functionality inherently, but at some point I'm not sure of, it lost this functionality and I can't get it back.