Answer the question
In order to leave comments, you need to log in
Draggable 2 in one block, need help?
Greetings, I need the help of a jqerry expert.
I use jqerry ui, I need to move blocks for sorting, here is the link - https://jqueryui.com/draggable/#sortable
structure is something like this:
<div class="block">
<div id="sortable">
//блок с вопросом, такие блоки добавляются друг за другом
<div class="draggable">
<div class="header-block">
<a class="move">переместить вопрос</a>
</div>
<div class="body-block">
<div>тут много блоков и разных текстов ссылок ul li и тп</div>
<div class="sortable2">
//блок с ответами, такие блоки добавляются друг за другом
<div class="draggable2">
<p>тут форма</p>
<a class="move2">переместить ответ</a>
</div>
//
</div>
<button class="addQuestion2">Добавить ответ</button>
</div>
</div>
//
</div>
<button class="addQuestion">Добавить вопрос</button>
</div>
$(function() {
$( "#sortable" ).sortable({
revert: true
});
$( ".draggable" ).draggable({
connectToSortable: "#sortable",
revert: "invalid",
handle: ".move",
cancel: ".body-block",
axis: "y"
});
$( ".sortable2" ).sortable({
revert: true
});
$( ".draggable2" ).draggable({
connectToSortable: ".sortable2",
revert: "invalid",
handle: ".move2",
axis: "y"
});
$( "ul, li, div" ).disableSelection();
});
Answer the question
In order to leave comments, you need to log in
The type entry $('.someclass').draggable()
means:
But for those elements that will appear in the future, this does not apply.
Use MutationObserver to watch for new elements and draggable them.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question