Experimenting with Dashboard dragging

by Anton

HTML

<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<div id="body">
    <div id="container">
        <div class="dragit">Drag it!</div>
    </div>
</div>

CSS

#body {
    height: 300px;
    width: 400px;
    overflow: auto;
}

#container {
    position: relative;
    height: 100%;
    width: 100%;
    padding: 10px;
    overflow: auto;
    box-sizing: border-box;
    background-color: lightgrey;
}

.dragit {
    position: absolute;
    top: 50px;
    left: 100px;
    width: 100px;
    height: 60px;
    line-height: 60px;
    text-align: center;
    box-shadow: 0 0 10px rgba(0,0,0,0.8);
    cursor: move;
}

JavaScript

$('.dragit').draggable({
    containment: '#container',
    scroll: true
});