Is there a way to make nested lists in twitter bootstrap look like a normal list, with the nested items simply indented (and have it work for an arbitrarily deep nesting)? B
Bootstrap 4 Update
I wanted to be able to use this with bootstrap 4. Hope this helps someone else.
Here is the code using font awesome (since glyphicons are not supported in V4).
Working jfiddle
Html
CSS
.just-padding {
padding: 15px;
}
.list-group.list-group-root {
padding: 0;
overflow: hidden;
}
.list-group.list-group-root .list-group {
margin-bottom: 0;
}
.list-group.list-group-root .list-group-item {
border-radius: 0;
border-width: 1px 0 0 0;
}
.list-group.list-group-root > .list-group-item:first-child {
border-top-width: 0;
}
.list-group.list-group-root > .list-group > .list-group-item {
padding-left: 30px;
}
.list-group.list-group-root > .list-group > .list-group > .list-group-item {
padding-left: 45px;
}
.list-group-item .glyphicon {
margin-right: 5px;
}
Javascript
$(function() {
$('.list-group-item').on('click', function() {
$('.fas', this)
.toggleClass('fa-angle-right')
.toggleClass('fa-angle-down');
});
});