Is it possible to have an item overflow horizontally out of a vertically scroll-able list?
I have a codepen example here:
http://codepen.io/baskuipers/pen/GqQYRJ
var $item = $('#1'),
$button = $('.button');
$button.on("click", function() {
$item.toggleClass('addMargin');
});
.sidenav {
width: 300px;
background-color: grey;
position: fixed;
padding: 20px;
}
.addMargin {
margin-left: 60px;
}
.item {
width: 100%;
overflow-y: auto;
height: 100vh;
z-index: 5;
position: relative;
}
.sub-item {
transition: margin-left 1s cubic-bezier(0.36, -0.48, 0, 2.22);
background-color: orange;
height: 100px;
width: 100%;
margin-bottom: 10px;
z-index: 10;
position: relative;
}
body {
box-sizing: border-box;
margin: 0;
padding: 0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="sidenav">
<button class="button">test</button>
<div class="item">
<div id="1" class="sub-item"></div>
<div class="sub-item"></div>
<div class="sub-item"></div>
<div class="sub-item"></div>
<div class="sub-item"></div>
</div>
</div>
In the example I'd like to have the yellow item stick out of the list. It is not a problem about the visibility of the scrollbars.
Any suggestions? CSS / JavaScript?
Thanks!