When having a fixed
element that has overflow: auto
or scroll
contained in a body
element that has overflow: hidden
, in Safari 8.0.x the scroll bar is not visible, but the element still scrolls. In Firefox 41.0.x the scroll bar is visible.
Here is a fiddle that shows the behavior.
Is there any way to keep the scroll bar visible in Safari?
*, *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html {
height: 100%;
}
body {
min-height: 100%;
position: relative;
margin: 0;
padding: 0;
}
.sidebar {
position: fixed;
max-height: 100vh;
min-height: 100vh;
background: lightblue;
width: 200px;
top: 0;
right: 0;
padding: 20px;
overflow-y: scroll;
}
.content-a {
background: yellow;
height: 900px;
}
.main {
background: grey;
min-height: 100vh;
padding: 10px;
}
.content-b {
height: 200px;
}
body, .main {
overflow: hidden;
}
<div class="sidebar">
<div class="content-a">
content
</div>
bottom
</div>
<div class="main">
<div class="content-b">
content
</div>
bottom
</div>