"builder"
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/ariona/pen/vgeoQx?depth=everything&order=popularity&page=4&q=Builder&show_forks=false" /> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css'><link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/dragula/3.7.1/dragula.min.css'><link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css'> <style class="cp-pen-styles">@import 'https://fonts.googleapis.com/css?family=Karla'; * { box-sizing: border-box; } body { font-family: karla; color: #666; } #elements { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; padding: 20px 0; -webkit-transition: 0.3s ease; transition: 0.3s ease; margin-bottom: 30px; } .element { border: 1px solid #e3e3e3; border-radius: 2px; margin: 0 5px; min-width: 64px; position: relative; -webkit-transition: 0.3s ease; transition: 0.3s ease; } .element-icon { text-align: center; padding: 10px; cursor: pointer; background-color: #fff; } .element-icon .fa { margin-bottom: 10px; } .element-name { font-size: 14px; } .element-controls { border-radius: 3px; background-color: rgba(0,0,0,0.1); position: absolute; bottom: 100%; white-space: nowrap; -webkit-transition: 0.3s ease; transition: 0.3s ease; opacity: 0; left: 0; overflow: hidden; } .element-controls button { border: none; background-color: transparent; padding: 5px 10px; -webkit-transition: 0.3s ease; transition: 0.3s ease; display: inline-block; } .element-controls button.delete-element:hover { background-color: #c00; color: #fff; } .element-controls button.options:hover { background-color: #33f; color: #fff; } .element-content { display: none; } #preview { background-color: rgba(0,0,0,0.1); border: 1px solid #efefef; min-height: 48px; display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap; padding: 0; width: 1200px; max-width: 100%; margin: 0 auto; } #preview .element { min-width: auto; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; margin: 0; } #preview .element:hover { background-color: rgba(0,0,0,0.1); } #preview .element-icon { display: none; } #preview .element-content { display: block; } #preview .element[data-element-name="logo"] { padding-left: 15px; padding-right: 15px; } #preview .element[data-element-name="logo"] img { display: block; } #preview .element[data-element-name="spacer"] { -webkit-box-flex: 1; -ms-flex: 1 0 auto; flex: 1 0 auto; text-align: center; -ms-flex-item-align: stretch; align-self: stretch; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-transition: 0.3s ease; transition: 0.3s ease; } #preview .element:hover .element-controls { pointer-events: auto; opacity: 1; } ul.menu { list-style: none; padding-left: 0; } ul.menu li { display: inline-block; padding: 10px 20px; } .mini-cart { border: none; background-color: transparent; position: relative; padding-left: 20px; padding-right: 20px; } .mini-cart .cart-num { position: relative; display: inline-block; top: -5px; background-color: #bad455; padding: 2px 4px; border-radius: 40px; color: #fff; font-size: 12px; } button.search { background: transparent; border: none; padding-left: 20px; padding-right: 20px; } .element.gu-mirror { min-width: 64px; max-width: 64px !important; } .element.gu-mirror-content { display: none; } </style></head><body> <div class="builder"> <div id="elements"> <div class="element" data-element-name="logo"> <div class="element-icon"><i class="fa fa-adn"></i> <div class="element-name">Logo</div> </div> <div class="element-controls"> <button class="delete-element"><i class="fa fa-trash-o"></i></button> <button class="options"><i class="fa fa-cogs"></i></button> </div> <div class="element-content"><img src="http://unsplash.it/50/50"/></div> </div> <div class="element" data-element-name="menu"> <div class="element-icon"><i class="fa fa-align-justify"></i> <div class="element-name">Menu</div> </div> <div class="element-controls"> <button class="delete-element"><i class="fa fa-trash-o"></i></button> <button class="options"><i class="fa fa-cogs"></i></button> </div> <div class="element-content"> <ul class="menu"> <li>home</li> <li>about</li> <li>projects</li> <li>contact</li> </ul> </div> </div> <div class="element" data-element-name="spacer"> <div class="element-icon"><i class="fa fa-arrows-h"></i> <div class="element-name">Flex</div> </div> <div class="element-controls"> <button class="delete-element"><i class="fa fa-trash-o"></i></button> <button class="options"><i class="fa fa-cogs"></i></button> </div> <div class="element-content"><i class="fa fa-arrows-h"></i></div> </div> <div class="element" data-element-name="cart"> <div class="element-icon"><i class="fa fa-shopping-cart"></i> <div class="element-name">Cart</div> </div> <div class="element-controls"> <button class="delete-element"><i class="fa fa-trash-o"></i></button> <button class="options"><i class="fa fa-cogs"></i></button> </div> <div class="element-content"> <button class="mini-cart"><i class="fa fa-shopping-cart"></i> <div class="cart-num">5</div> </button> </div> </div> <div class="element" data-element-name="search"> <div class="element-icon"><i class="fa fa-search"></i> <div class="element-name">Search</div> </div> <div class="element-controls"> <button class="delete-element"><i class="fa fa-trash-o"></i></button> <button class="options"><i class="fa fa-cogs"></i></button> </div> <div class="element-content"> <button class="search"><i class="fa fa-search"></i></button> </div> </div> </div> <div id="preview"> <div class="element" data-element-name="logo"> <div class="element-icon"><i class="fa fa-adn"></i> <div class="element-name">Logo</div> </div> <div class="element-controls"> <button class="delete-element"><i class="fa fa-trash-o"></i></button> <button class="options"><i class="fa fa-cogs"></i></button> </div> <div class="element-content"><img src="http://unsplash.it/50/50"/></div> </div> <div class="element" data-element-name="menu"> <div class="element-icon"><i class="fa fa-align-justify"></i> <div class="element-name">Menu</div> </div> <div class="element-controls"> <button class="delete-element"><i class="fa fa-trash-o"></i></button> <button class="options"><i class="fa fa-cogs"></i></button> </div> <div class="element-content"> <ul class="menu"> <li>home</li> <li>about</li> <li>projects</li> <li>contact</li> </ul> </div> </div> <div class="element" data-element-name="spacer"> <div class="element-icon"><i class="fa fa-arrows-h"></i> <div class="element-name">Flex</div> </div> <div class="element-controls"> <button class="delete-element"><i class="fa fa-trash-o"></i></button> <button class="options"><i class="fa fa-cogs"></i></button> </div> <div class="element-content"><i class="fa fa-arrows-h"></i></div> </div> <div class="element" data-element-name="cart"> <div class="element-icon"><i class="fa fa-shopping-cart"></i> <div class="element-name">Cart</div> </div> <div class="element-controls"> <button class="delete-element"><i class="fa fa-trash-o"></i></button> <button class="options"><i class="fa fa-cogs"></i></button> </div> <div class="element-content"> <button class="mini-cart"><i class="fa fa-shopping-cart"></i> <div class="cart-num">5</div> </button> </div> </div> </div> </div> <script src='//production-assets.codepen.io/assets/common/stopExecutionOnTimeout-b2a7b3fe212eaa732349046d8416e00a9dec26eb7fd347590fbced3ab38af52e.js'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/dragula/3.7.1/dragula.min.js'></script> <script >var builder = dragula([document.getElementById("elements"), document.getElementById("preview")], { copy: function(el, source) { return source === document.getElementById("elements") }, accepts: function(el, target) { return target !== document.getElementById("elements") }, removeOnSpill: true, direction: 'horizontal' }); builder.on('drop', (el, container) => { var data = []; var elements = $(container).find(".element"); $.each(elements, function(key, value) { data.push({ 'el': $(value).data('element-name'), 'content': $(value).find(".element-content").html() }); }); builderOutput(data); }); function builderOutput(data) { console.log(data); } $("#preview").on("click", '.delete-element', function(e) { e.preventDefault(); var deleteEl = confirm("Are you sure want to delete this element?"); if (deleteEl) { $(this).parents(".element").remove(); } }); //# sourceURL=pen.js </script> </body></html>

Related: See More


Questions / Comments: