Background labels


List item
List item
List item
List item
List item
List item
List item
List item
List item
List item


HTML:
<div id='outerCont'>
    <div id='listCont'>
        <div class='listItem'>
            List item
        </div>
        <div class='listItem'>
            List item
        </div>
        ...
    </div>
</div>

CSS:
#outerCont {
	height: 300px;
	overflow: auto;
	border: 1px solid #777777;
}

#listCont {
	position: relative;
}

.listItem {
	padding: 1.4em;
	background-color: #FFFFFF;
	border-bottom: 1px solid #DDDDDD;
}

.mask div {
	position: relative;
	width: 100%;
	height: 100%;
}

.mask div span {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	color: white;
}

.mask div span.left {
	right: 0.6em;
}

.mask div span.right {
	left: 0.6em;
}

JS:
var labelLeft = document.createElement('div');
labelLeft.innerHTML = '<span class=\'left\'>Delete</span>';

var labelRight = document.createElement('div');
labelRight.innerHTML = '<span class=\'right\'>Archive</span>';

lithiumlist.attachToList(
    '123456789',
    document.getElementById('outerCont'),
    document.getElementById('listCont'),
    'listItem',
    {
    	sortEnabled: false,
	    leftMasks: [{
	    	background: 'red',
	    	classNameDefault: 'mask',
			childNode: labelLeft
	    }],
	    rightMasks: [{
	    	background: 'green',
	    	classNameDefault: 'mask',
			childNode: labelRight
	    }]
    }
);