Css自定义div中垂直滚动条溢出的颜色?

时间:2015-01-07 04:02:53

标签: html css

如何在CSS中的一个div中自定义溢出滚动条的颜色?

1 个答案:

答案 0 :(得分:0)

尝试这样:

<head>    

    <!-- latest jQuery direct from google's CDN -->
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

    <!-- the mousewheel plugin - optional to provide mousewheel support -->
    <script type="text/javascript" src="http://jscrollpane.kelvinluck.com/script/jquery.mousewheel.js"></script>

    <!-- the jScrollPane script -->
    <script type="text/javascript" src="http://jscrollpane.kelvinluck.com/script/jquery.jscrollpane.min.js"></script>

    <script type="text/javascript" >
        $(function() {
            $('.scroll-pane').jScrollPane();
        });        
    </script>
</head>


<body>
<div id="wrapper" class="scroll-pane">
    <ul id="tbl-title"> 
        <li class="seperator">DVD Title</li>
        <li class="seperator">Category</li>
        <li>Book</li>          
    </ul>

    <div id="tbl-data">
        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>

        <ul class="tbl-row"> 
            <li class="seperator">
                <span>FUKO</span>            
            </li>
            <li class="seperator">
                <span>ANIME</span>            
            </li>
            <li>
                <span>NO BOOK</span>
            </li>              
        </ul>
    </div>
</div>
</body>

的CSS:

#tbl-title,
.tbl-row {
   margin:0;
   padding:0;
   list-style-type: none;   
}

#tbl-title li,
.tbl-row li
{
    float: left;
    width: 33%;
    color: #333;
    font-size: 13px;
    padding: 5px 0;
    font-family: tahoma;    
}

#tbl-title li{
    background: #ccc;
    font-weight: bold;
    text-align:center;
    border-bottom: 1px solid #999;    
}
.tbl-row li {
    background: #f4f4f4;
    font-weight: normal;
    text-align:left;
    border-bottom: 1px solid #fff;    
}

.tbl-row li span { 
    display: block; 
    padding: 0px 10px; 
    text-transform: uppercase; 
}

.seperator {
    border-right: 1px solid #fff;
}

/* Styles specific to this particular page */
.scroll-pane {
    width: 100%;
    height: 200px;
    overflow: auto;
}

/*
 * CSS Styles that are needed by jScrollPane for it to operate correctly.
 *
 * Include this stylesheet in your site or copy and paste the styles below into your stylesheet - jScrollPane
 * may not operate correctly without them.
 */

.jspContainer
{
    overflow: hidden;
    position: relative;
}

.jspPane
{
    position: absolute;
}

.jspVerticalBar
{
    position: absolute;
    top: 0;
    right: 0;
    width: 7px;
    height: 100%;
    background: red;
}

.jspHorizontalBar
{
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 7px;
    background: #777;
}

.jspVerticalBar *,
.jspHorizontalBar *
{
    margin: 0;
    padding: 0;
}

.jspCap
{
    display: none;
}

.jspHorizontalBar .jspCap
{
    float: left;
}

.jspTrack
{
    background: #777;
    position: relative;
}

.jspDrag
{
    background: #aaa;
    position: relative;
    top: 0;
    left: 0;
    cursor: pointer;
}

.jspHorizontalBar .jspTrack,
.jspHorizontalBar .jspDrag
{
    float: left;
    height: 100%;
}

.jspArrow
{
    background: #50506d;
    text-indent: -20000px;
    display: block;
    cursor: pointer;
}

.jspArrow.jspDisabled
{
    cursor: default;
    background: #80808d;
}

.jspVerticalBar .jspArrow
{
    height: 7px;
}

.jspHorizontalBar .jspArrow
{
    width: 7px;
    float: left;
    height: 100%;
}

.jspVerticalBar .jspArrow:focus
{
    outline: none;
}

.jspCorner
{
    background: #eeeef4;
    float: left;
    height: 100%;
}

/* Yuk! CSS Hack for IE6 3 pixel bug :( */
* html .jspCorner
{
    margin: 0 -3px 0 0;
}