I am creating a horizontal scroll bar at the top of my table in HTML. I have been following this example:
horizontal scrollbar on top and bottom of table
This is my code: (I do not have .wrapper2
or .div2
as mentioned:
HTML
<div class="wrapper1">
<div class="scrollTop"></div>
</div>
<div class="tableData">
<table>
"..."
</table>
</div>
CSS
.tableData {
box-shadow: 10px 10px 5px #000;
-webkit-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;
overflow: auto;
}
.wrapper1, .tableData {
margin: 20px;
overflow-x: scroll;
overflow-y: hidden;
}
.wrapper1 {
height: 20px;
}
.scrollTop {
width: 1000px;
height: 20px;
}
JS
$(function(){
$(".wrapper1").scroll(function(){
$(".tableData").scrollLeft($(".wrapper1").scrollLeft());
});
$(".tableData").scroll(function(){
$(".wrapper1").scrollLeft($(".tableData").scrollLeft());
});
});
My problem is that my top scroll bar is not visible. The container of it is but not the actual bar itself (as you can see):
All the JS is running properly so thinking it mush be an issue within the CSS? I'm not entirely sure.
EDIT
From the screenshot above, you can see that the bottom scroll bar within it's container is visible so it can be interacted with. The top scroll bar, however, is not. It's container is visible but the actual bar itself is not so cannot be interacted with and unable to scroll.