"draggable"
Bootstrap 3.0.0 Snippet by evarevirus

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <!DOCTYPE html><html lang='en' class=''> <head><script src='//production-assets.codepen.io/assets/editor/live/console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/events_runner-73716630c22bbc8cff4bd0f07b135f00a0bdc5d14629260c3ec49e5606f98fdd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/css_live_reload_init-2c0dc5167d60a5af3ee189d570b1835129687ea2a61bee3513dee3a50c115a77.js'></script><meta charset='UTF-8'><meta name="robots" content="noindex"><link rel="shortcut icon" type="image/x-icon" href="//production-assets.codepen.io/assets/favicon/favicon-8ea04875e70c4b0bb41da869e81236e54394d63638a1ef12fa558a4a835f1164.ico" /><link rel="mask-icon" type="" href="//production-assets.codepen.io/assets/favicon/logo-pin-f2d2b6d2c61838f7e76325261b7195c27224080bc099486ddd6dccb469b8e8e6.svg" color="#111" /><link rel="canonical" href="https://codepen.io/anacuco/pen/tbydm?limit=all&page=14&q=draggable" /> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css'><script src='https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js'></script><link rel='stylesheet prefetch' href='//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css'> <style class="cp-pen-styles">body { background-color: #333; font: 14px/18px Arial, sans-serif; } p { margin: 0; } .sidebar-menus { position: absolute; top: 0; left: 55%; width: 30%; } .draggable-elements { margin-top: 20px; position: relative; z-index: 2; } .draggable-elements .element { border-radius: 3px; box-shadow: 0 0 2px 0 #000; background-color: #6C3; border-top: 1px solid #CCC; margin: 2px 0; padding: 5px; vertical-align: top; min-height: 43px; z-index: 1; } .draggable-elements .element .icons-fonts { opacity: 0.4; float: left; } .draggable-elements .element .icons-fonts.move { cursor: move; width: 16px; height: 20px; font-size: 24px; font-weight: bold; line-height: 22px; } .draggable-elements .element .name, .draggable-elements .element .type { padding-left: 20px; } .draggable-elements .element .name { color: #FFF; word-break: break-all; font-size: 17px; } .draggable-elements .element .f-type { font-size: 10px; opacity: 0.4; padding-left: 20px; } .draggable-elements .element .close, .draggable-elements .element .jqTransformSelectWrapper { display: none; } .draggable-elements .element.ui-draggable-dragging { width: 250px !important; } .dragdrop-field { margin: 20px 0 0 20px; width: 50%; } .dragdrop-field .dragdrop-box { background-color: #FFF; position: relative; z-index: 1; overflow: hidden; border-radius: 3px; box-shadow: inset 0 0 2px #333; } .dragdrop-field .dragdrop-box #dragndrop { background: #FFF; border: 2px dashed #FFF; margin: 6px; min-height: 97px; } .dragdrop-field .dragdrop-box #dragndrop > p { position: absolute; top: 0; left: 0; width: 100%; text-align: center; color: #BBB; line-height: 97px; font-weight: bold; } .dragdrop-field .dragdrop-box #dragndrop.highlight { border: 2px dashed #CCC; background-color: #F2F2F2; } .dragdrop-field .dragdrop-box #dragndrop.highlight > p { color: #666; } .dragdrop-field .dragdrop-box #dragndrop li { position: relative; } .dragdrop-field .dragdrop-box #dragndrop li .close { display: block; position: absolute; top: 50%; right: 10px; margin-top: -10px; color: #000; opacity: 0.5; font-weight: bold; font-size: 20px; } .dragdrop-field .dragdrop-box #dragndrop li .close:hover { color: #FFF; opacity: 1; } .dragdrop-field .dragdrop-box #dragndrop li .move:before { margin-left: 4px; } </style></head><body> <div class="sidebar-menus"> <ul id="draggable-elements" class="draggable-elements ui-helper-reset ui-helper-clearfix"> <li class="element ui-widget-content ui-corner-tr"> <b class="icons-fonts move">+</b> <p class="name">First draggable button</p><p class="f-type">(small information)</p> <a href="javascript:void(0)" title="Delete this element" class="icons-fonts close">x</a> </li> <li class="element ui-widget-content ui-corner-tr"> <b class="icons-fonts move">+</b> <p class="name">Second draggable button</p><p class="f-type">(small information)</p> <a href="javascript:void(0)" title="Delete this element" class="icons-fonts close">x</a> </li> </ul> </div> <div class="dragdrop-field"> <div class="dragdrop-box"> <div id="dragndrop" class="draggable-elements ui-widget-content ui-state-default"> <p>Drag and Drop elements here</p> </div> </div> </div> <script src='//production-assets.codepen.io/assets/common/stopExecutionOnTimeout-b2a7b3fe212eaa732349046d8416e00a9dec26eb7fd347590fbced3ab38af52e.js'></script><script src='//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script><script src='//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js'></script> <script >$(document).ready(function() { dragging_elements(); }); function dragging_elements(){ $(function() { // drag $( "#draggable-elements li" ).draggable({ revert: "true", helper: "clone", handle: ".icons-fonts.move", connectToSortable: "#dragndrop" }); // sortable and drop $( "#dragndrop" ).sortable({ handle: ".icons-fonts.move" }).droppable({ accept: '.element', activeClass: 'highlight' }); // remove element $('.dragdrop-field').on('click','.close', function(){ $(this).closest('.element').fadeOut("slow"); }); }); } //# sourceURL=pen.js </script> </body></html>

Related: See More


Questions / Comments: