I work with JQuery UI sorters and created a divs system in this format;
<div class='mainDiv'> <label>text: <input type='text' name='textbox' /></label> <div class='children'> <div class='mainDiv'>...</div> <div class='mainDiv'>...</div> <div class='mainDiv'> <label>text: <input type='text' name='textbox' /></label> <div class='children'>...</div> </div> </div> </div>
Divs can have an infinite number of children, and I want to be able to drag and drop all .mainDiv into their parent field, so I used this:
$(".mainDiv").parent().sortable({items: ".mainDiv", containment: "parent"});
However, this allows you to move elements to your child or child divs. which I do not want. I want to limit the elements to being within their parent.
Any help here would be hot.
Greetings
I managed to solve it like this:
$(this).parent().sortable({ items: '> li', axis: 'y', ... });
In your case, it should work with:
items: '> .mainDiv'
containment: “parental” not required.
"sortable" , . , , "mousedown". (, Ajax), "livequery".
Source: https://habr.com/ru/post/1707846/More articles:How to run VBScript on Windows NT 4? - vbscriptHow to check if user has a specific role in JSP? - jsphow to change column id increment - sqlПочему плагин flexbuilder для eclipse так медленно открывается и компилируется? - compiler-constructionDynamic height and height in Flash AS3 - flashCan I compile java? - javaHow to create a DataTemplate using Expression Blend 3? - data-bindingThe increase problem - c ++Список <Странa> становится Страна [] через веб-службу - c#Saving a Word File as an Image - c #All Articles