JSFiddle - React, Tailwind, and code Playground
by Graham Dixon
HTML
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script src="https://lasdashboard.co.uk/BuildForm/JS/jquery.gform/jquery.htmlClean.js"></script>
<script src="http://daffl.github.io/jquery.dform/release/jquery.dform-1.1.0.js"></script>
<div class="dd" id="nestable2">
<ol class="dd-list">
<li class="dd-item dd3-item" data-id="13">
<div class="dd-handle dd3-handle"></div><div class="dd3-content"><input type="text" name="test"></input></div>
</li>
<li class="dd-item dd3-item nestAllowed" data-id="14">
<button data-action="collapse" type="button">Collapse</button> <button data-action="expand" type="button" style="display:none;">Expand</button>
<div class="dd-handle dd3-handle">Drag</div>
<div class="dd3-content ">NEST - Multi Texts</div>
<ol class="dd-list">
<li class="dd-item dd3-item" data-id="13">
<div class="dd-handle dd3-handle"></div><div class="dd3-content"><input type="text" name="test"></input></div>
</li>
<li class="dd-item dd3-item" data-id="13">
<div class="dd-handle dd3-handle"></div><div class="dd3-content"><input type="text" name="test2"></input></div>
</li>
</ol>
</li>
<li class="dd-item" data-id="15">
<div class="dd-handle">Item 15</div>
<ol class="dd-list">
<li class="dd-item" data-id="16"><div class="dd-handle2">Item 16</div></li>
<li class="dd-item" data-id="17"><div class="dd-handle2">Item 17</div></li>
<li class="dd-item" data-id="18"><div class="dd-handle2">Item...
CSS
/**
* Nestable
*/
.dd { position: relative; display: block; margin: 0; padding: 0; max-width: 600px; list-style: none; font-size: 13px; line-height: 20px; }
.dd-list { display: block; position: relative; margin-left:5px; padding: 0; list-style: none; }
.dd-list .dd-list { padding-left: 30px; }
.dd-collapsed .dd-list { display: none; }
.dd-item,
.dd-empty,
.dd-placeholder { display: block; position: relative; margin: 0; padding: 0; min-height: 20px; font-size: 13px; line-height: 20px; }
.dd-handle, .dd-handle2 { display: block; height: auto; margin: 5px 0; padding: 5px 10px; color: #333; text-decoration: none; font-weight: bold; border: 1px solid #ccc;
background: #fafafa;
background: -webkit-linear-gradient(top, #fafafa 0%, #eee 100%);
background: -moz-linear-gradient(top, #fafafa 0%, #eee 100%);
background: linear-gradient(top, #fafafa 0%, #eee 100%);
-webkit-border-radius: 3px;
border-radius: 3px;
box-sizing: border-box; -moz-box-sizing: border-box;
}
.dd-handle:hover, .dd-handle2:hover { color: #2ea8e5; background: #fff; }
.dd-item > button { display: block; position: relative; cursor: pointer; float: left; color:#000;width: 25px; height: 20px; margin: 5px 0; padding: 0; text-indent: 100%; white-space: nowrap; overflow: hidden; border: 0; background: transparent; font-size: 12px; line-height: 1; text-align: center; font-weight: bold; z-index:10;}
.dd-item > button:before { content: '+'; display: block; position: absolute; width: 100%; text-align: center; text-indent: 0; }
.dd-item > button[data-action="collapse"]:before { content: '-'; }
.dd-placeholder,
.dd-empty { margin: 5px 0; padding: 0; min-height: 30px; background: #f2fbff; border: 1px dashed #b6bcbf; box-sizing: border-box; -moz-box-sizing: border-box; }
.dd-empty { border: 1px dashed #bbb; min-height: 100px; background-color: #e5e5e5;
background-image: -webkit-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%,...
JavaScript
/*!
* Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
* Dual-licensed under the BSD or MIT licenses
*/
var nest2 = $('#nestable2').html();
;(function($, window, document, undefined)
{
var hasTouch = 'ontouchstart' in window;
/**
* Detect CSS pointer-events property
* events are normally disabled on the dragging element to avoid conflicts
* https://github.com/ausi/Feature-detection-technique-for-pointer-events/blob/master/modernizr-pointerevents.js
*/
var hasPointerEvents = (function()
{
var el = document.createElement('div'),
docEl = document.documentElement;
if (!('pointerEvents' in el.style)) {
return false;
}
el.style.pointerEvents = 'auto';
el.style.pointerEvents = 'x';
docEl.appendChild(el);
var supports = window.getComputedStyle && window.getComputedStyle(el, '').pointerEvents === 'auto';
docEl.removeChild(el);
return !!supports;
})();
var eStart = hasTouch ? 'touchstart' : 'mousedown',
eMove = hasTouch ? 'touchmove' : 'mousemove',
eEnd = hasTouch ? 'touchend' : 'mouseup';
eCancel = hasTouch ? 'touchcancel' : 'mouseup';
var defaults = {
listNodeName : 'ol',
itemNodeName : 'li',
rootClass : 'dd',
listClass : 'dd-list',
itemClass : 'dd-item',
dragClass : 'dd-dragel',
handleClass : 'dd-handle',
collapsedClass : 'dd-collapsed',
placeClass : 'dd-placeholder',
noDragClass : 'dd-nodrag',
emptyClass : 'dd-empty',
expandBtnHTML : '<button data-action="expand" type="button">Expand</button>',
collapseBtnHTML : '<button data-action="collapse" type="button">Collapse</button>',
group : 0,
maxDepth ...