mercredi 22 juin 2016

CSS element beneath the dropzone

I have created an infinite horizontal scrollbar. What happens is that I have the need to drag some elements to the dropzone, and they appear beneath the dropzone instead of above.

The html markup:

<div class="wrapper">
    <div class="header">
      Drop here
    </div>
    <div class="group-wrapper">
      <div class="group-list">
        <div class="group">Drag me</div>
        <div class="group">Drag me</div>
        <div class="group">Drag me</div>
        <div class="group">Drag me</div>
        <div class="group">Drag me</div>
        <div class="group">Drag me</div>
        <div class="group">Drag me</div>
      </div>
    </div>
</div>

The css:

.wrapper .header 
{
    overflow: hidden;
    padding: 8px 4px 10px 8px;
    position: relative;
    width: 100%;
    background-color: #ccc;
    height: 100px;
    text-align: center;
    padding-top: 15px;
}

.wrapper .group-wrapper 
{
    width: 100%;
    padding: 0px 5px 0px 8px;
    top: 20px;
    white-space: nowrap;
    position: relative;
    margin-left: 3px;
    margin-right: 5px;
    overflow-y: auto;
    overflow-x: auto;
}

.wrapper .group-wrapper .group
{
    width: 25%;
    display: inline-block;
    vertical-align: top;
    margin: 0px 30px 0px 0px;
    height: 100px;
    border: 1px solid #ccc;
    background-color: #000;
    cursor: pointer;
    color: #fff;
}

By removing the lines overflow-y: auto; overflow-x: auto; within the class .group-wrapper the draggable starts working perfectly but my scrollbars disappear.

JSFiddle

Aucun commentaire:

Enregistrer un commentaire