Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                    <h2 id="app_status">App status...</h2>
    <div id="container">
        <div class="drop_containers">
            <h1 class="text-center">Department One</h1>
            <div id="drop_zone_one" ondragover="return false"></div>
        </div>
        <div class="drop_containers">
            <h1 class="text-center">Department Two</h1>
            <div id="drop_zone_two" ondragover="return false"></div>
        </div>
        <div class="drop_containers">
            <h1 class="text-center">Department Three</h1>
            <div id="drop_zone_three" ondragover="return false"></div>
        </div>
        <div class="drop_containers">
            <h1 class="text-center">Department Four</h1>
            <div id="drop_zone_four" ondragover="return false"></div>
        </div>
    </div>


    <div>
        <h2 class="text-center">New Travelers</h2>
        <div id="object1" class="objects" draggable="true">
            <p><strong>Trav #:</strong> 1001</p>
            <p><strong>Qty:</strong> 100</p>
        </div>
        <div id="object2" class="objects" draggable="true">
            <p><strong>Trav #:</strong> 1002</p>
            <p><strong>Qty:</strong> 150</p>
        </div>
        <div id="object3" class="objects" draggable="true">
            <p><strong>Trav #:</strong> 1003</p>
            <p><strong>Qty:</strong> 100</p>
        </div>
        <div id="object4" class="objects" draggable="true">
            <p><strong>Trav #:</strong> 1004</p>
            <p><strong>Qty:</strong> 10</p>
        </div>
    </div>

    <div class="clear-fix"></div>

    <hr>
    <div class="btn-div">
        <button onclick="readDropZone()">Get Object Data</button>
    </div>
              
            
!

CSS

              
                body {
    font-family: Arial;
}
#app_status {
    text-align: center;
}
.objects {
    /*display: inline-block;*/
    float: left;
    background-color: #fff;
    border: #000 1px solid;
    border-radius: 10px;
    margin: 1%;
    padding: .8%;
    font-size: 18px;
    text-align: center;
    box-shadow: 2px 2px 2px #999;
    cursor: move;
}
.drop_containers {
    display: inline-block;
    width: 22%;
    margin: 1%;
}
.drop_containers>div {
    width: 100%;
}
#container {
    min-width: 800px;
    overflow: scroll;
}
#drop_zone_one, #drop_zone_two, #drop_zone_three, #drop_zone_four {
    border: #999 1px solid;
    width: 100%;
    height: 450px;
    padding: 8px;
    font-size: 18px;
    border-radius: 10px;
}
#drop_zone_one {
    background-color: #ed9595;
}
#drop_zone_two {
    background-color: #8294ed;
}
#drop_zone_three {
    background-color: #d8ed7b;
}
#drop_zone_four {
    background-color: #69ea7a;
}
button {
    width: 60%;
    padding: 10px;
    font-size: 26px;
    border-radius: 10px;
    background-color: #ddd;
}
.btn-div {
    display:flex;
    justify-content: center;
    align-items: center;
}
.text-center {
    text-align: center;
}
.clear-fix {
    clear:both;
}
              
            
!

JS

              
                function _(id) {
    return document.getElementById(id);
}

document.addEventListener("DOMContentLoaded", function(event){
    _('drop_zone_one').addEventListener("dragenter", drag_enter);
    _('drop_zone_one').addEventListener("dragleave", drag_leave);
    _('drop_zone_one').addEventListener("drop", drag_drop);

    _('drop_zone_two').addEventListener("dragenter", drag_enter);
    _('drop_zone_two').addEventListener("dragleave", drag_leave);
    _('drop_zone_two').addEventListener("drop", drag_drop);

    _('drop_zone_three').addEventListener("dragenter", drag_enter);
    _('drop_zone_three').addEventListener("dragleave", drag_leave);
    _('drop_zone_three').addEventListener("drop", drag_drop);

    _('drop_zone_four').addEventListener("dragenter", drag_enter);
    _('drop_zone_four').addEventListener("dragleave", drag_leave);
    _('drop_zone_four').addEventListener("drop", drag_drop);

    _('object1').addEventListener("dragstart", drag_start);
    _('object1').addEventListener("dragend", drag_end);
    _('object2').addEventListener("dragstart", drag_start);
    _('object2').addEventListener("dragend", drag_end);
    _('object3').addEventListener("dragstart", drag_start);
    _('object3').addEventListener("dragend", drag_end);
    _('object4').addEventListener("dragstart", drag_start);
    _('object4').addEventListener("dragend", drag_end);
});

var droppedIn = false;

function drag_start(event) {
    _('app_status').innerHTML = "Dragging the " + event.target.getAttribute('id');
    event.dataTransfer.dropEffect = "move";
    event.dataTransfer.setData("text", event.target.getAttribute('id'));
}

function drag_enter(event) {
    _('app_status').innerHTML = "You are dragging over the " + event.target.getAttribute('id');
}

function drag_leave(event) {
    _('app_status').innerHTML = "You left the " . event.target.getAttribute('id');
}

function drag_drop(event) {
    event.preventDefault();
    var elem_id = event.dataTransfer.getData("text");
    event.target.appendChild( _(elem_id) );
    _(elem_id).style.width = "95%";
    _('app_status').innerHTML = "Drpped " + elem_id + " into the " + event.target.getAttribute('id');
    droppedIn = true;
}

function drag_end(event) {
    if(droppedIn == false) {
        _('app_status').innerHTML = "You let the " + event.target.getAttribute('id') + " go.";
    }
    droppedIn = false;
}

function readDropZone(){
    for(var i=0; i < _('drop_zone_one').children.length; i++){
        console.log(_('drop_zone_one').children[i].id + " is in the Wrap Department");
    }
    for(var i=0; i < _('drop_zone_two').children.length; i++){
        console.log(_('drop_zone_two').children[i].id + " is in the Mold Department");
    }
    for(var i=0; i < _('drop_zone_three').children.length; i++){
        console.log(_('drop_zone_three').children[i].id + " is in the Trim Department.");
    }
    for(var i=0; i < _('drop_zone_four').children.length; i++){
        console.log(_('drop_zone_four').children[i].id + " is in the Visual Department");
    }
    // Run Ajax request to pass any data to your server
}
              
            
!
999px

Console