javascript - hide vertical scroll in scrollable table -
i have implemented scrollable table pinned column , vertical , horizontal scrolling enabled. want hide vertical scroll appears besides pinned column. here plunker link. html looks this:
<div class="col-md-12"> <div class="col-md-3" style="padding:0;"> <table class="table" style="margin-bottom:0;"> <thead> <tr> <th>fixed</th> </tr> </thead> </table> <div style="height:100px; overflow-y:auto" id="fixed" on-scroll=""> <table class="table" style="margin-bottom:0"> <tbody> <tr data-ng-repeat="data in [1,2,3,4]"> <td>data data data data data data data data</td> </tr> </tbody> </table> </div> </div> <div class="col-md-9" style="padding:0;overflow:hidden"> <div id="topright" style="padding:0;overflow-x:hidden" on-scroll=""> <table class="table" style="margin-bottom:0"> <thead> <tr> <th style="min-width:200px">column 1</th> <th style="min-width:200px">column 2</th> <th style="min-width:200px">column 3</th> <th style="min-width:200px">column 4</th> <th style="min-width:200px">column 5</th> </tr> </thead> </table> </div> <div style="height:100px; overflow:auto" id="bottomright" on-scroll=""> <table class="table" style="margin-bottom:0"> <tbody> <tr data-ng-repeat="data in [1,2,3,4]"> <td style="min-width:200px">data data data data data data data data</td> <td style="min-width:200px">data data data data data data data data</td> <td style="min-width:200px">data data data data data data data data</td> <td style="min-width:200px">data data data data data data data data</td> <td style="min-width:200px">data data data data data data data data</td> </tr> </tbody> </table> </div> </div> </div>
thank you
there no real cross-browser solution doing this, best answer can find here:
answer link
for completeness' sake, works webkit:
#element::-webkit-scrollbar { display: none; }
if want scrollbars hidden, use
::-webkit-scrollbar { display: none; }
i'm not sure restoring - did work, there might right way it:
::-webkit-scrollbar { display: block; }
you can of course use width: 0
, can restored width: auto
, i'm not fan of abusing width
visibility tweaks.
to see if current browser supports this, try snippet:
.content { /* these rules create artificially confined space, scrollbar can hide. not part of hiding itself. */ border: 1px dashed gray; padding: .5em; white-space: pre-wrap; height: 5em; overflow-y: scroll; } .content::-webkit-scrollbar { /* magic bit */ display: none; }
<div class='content'> lorem ipsum dolor sit amet, consectetur adipiscing elit. mauris eu urna et leo aliquet malesuada ut ac dolor. fusce non arcu vel ligula fermentum sodales quis sapien. sed imperdiet justo sit amet venenatis egestas. integer vitae tempor enim. in dapibus nisl sit amet purus congue tincidunt. morbi tincidunt ut eros in rutrum. sed quam erat, faucibus vel tempor et, elementum @ tortor. praesent ac libero @ arcu eleifend mollis ut eget sapien. duis placerat suscipit eros, eu tempor tellus facilisis a. vivamus vulputate enim felis, euismod diam elementum non. duis efficitur ac elit non placerat. integer porta viverra nunc, sed semper ipsum. nam laoreet libero lacus. sed sit amet tincidunt felis. sed imperdiet, nunc ut porta elementum, eros mi egestas nibh, facilisis rutrum sapien dolor quis justo. quisque nec magna erat. phasellus vehicula porttitor nulla et dictum. sed tincidunt scelerisque finibus. maecenas consequat massa aliquam pretium volutpat. duis elementum magna vel velit elementum, ut scelerisque odio faucibus. </div>
(note not correct answer question because hides horizontal bars well, that's looking when google pointed me here, figured i'd post anyway.)
Comments
Post a Comment