0

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):

enter image description here

All the JS is running properly so thinking it mush be an issue within the CSS? I'm not entirely sure.

EDIT

enter image description here

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.

Community
  • 1
  • 1
wmash
  • 4,032
  • 3
  • 31
  • 69

2 Answers2

0

Change your CSS to this:

.wrapper1, .tableData {
    width: 100%; 
    border: none 0px RED; 
    overflow-x: scroll; 
    overflow-y:hidden;
}

.tableData {
    box-shadow: 10px 10px 5px #000;
    -webkit-border-radius: 25px;
    -moz-border-radius: 25px;
    border-radius: 25px;
}

.wrapper1 {
    height: 20px; 
}

.tableData{
     height: 200px; 
}
.scrollTop {
    width:1000px; 
    height: 20px; 
}

table {
    width:1000px; 
    height: 200px; 
    overflow: auto;
}

Working example: http://jsfiddle.net/ggChris/d8ayfnnp/

Chris
  • 432
  • 3
  • 11
0

Change Your CSS

.tableData {
box-shadow: 10px 10px 5px #000;

-webkit-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;

}

Demo Link http://jsfiddle.net/TBnqw/3144/

Lalji Tadhani
  • 14,041
  • 3
  • 23
  • 40