-1

I am having the below code for display custom scrollbar. Here some background is showing, instead of this I need display a 1px thin line image.. How can I do this? I am using the TinyScroller

Css:

#wrapper_1 {width:99%; height:600px; padding:2px}
#scroll_1 {position:relative; width:99%; height:600px; overflow:auto}
#scrollcontent_1 {position:absolute; width:94%; z-index:200}
#scrollbar_1 {float:right; position:relative; border:0; display:none; width:15px; height:600px; z-index:100; background:url(images/scroll-bg.png)}
.scroller_1 {position:relative; top:0; cursor:pointer; border:0; width:15px; background-image:url(images/scroller.png); background-position:50% 50%; background-repeat:no-repeat}
.buttonclick_1 {}

Code:

<div id="wrapper_1">
<div id="scroll_1">
<div id="scrollcontent_1">
<h1>TinyScroller</h1>
<p>test message</p>
</div>
<div id="scrollbar_1">
<div id="scroller_1" class="scroller_1"></div>
</div>
</div>
</div>
<script type="text/javascript"> 
TINY.scroller.init('scroll_1','scrollcontent_1','scrollbar_1','scroller_1','buttonclick_1');
</script>
6

2 Answers 2

2

Well if you are in Chrome you can use plain ol' CSS:

::-webkit-scrollbar {
    width: 15px;
    height: 15px;
}

::-webkit-scrollbar-track {
    background-clip: padding-box;
    border: solid transparent;
    border-width: 0 0 0 4px;
}

::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, .2);
    background-clip: padding-box;
    border: solid transparent;
    border-width: 1px 1px 1px 6px;
    min-height: 28px;
    padding: 100px 0 0;
    box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .1),inset 0 -1px 0 rgba(0, 0, 0, .07);
}

::-webkit-scrollbar-corner {
    background: transparent;
}

::-webkit-scrollbar-button {
    display: none;
}

Demo: http://jsfiddle.net/maniator/ysgBy/
Site to check out: http://css-tricks.com/custom-scrollbars-in-webkit/

4
  • Yeah.. This is working. But I need a small background image must come back side of this color scroll box.. Aug 17, 2012 at 12:38
  • @user1587577 I am not sure what you mean, but you can edit the scrollbar in any way with CSS.
    – Naftali
    Aug 17, 2012 at 12:39
  • manos.malihu.gr/tuts/custom-scrollbar-plugin/… Kindly check this link for my req.. Also this is 3rd coloumn with the title of "Fluid height container without mouse-wheel support".. Please help me Aug 17, 2012 at 12:51
  • I try this solution.. Its working in Chrome only.. But Now I am using all major browsers.. how can I use this? Aug 23, 2012 at 7:47
0

According to the doc http://www.scriptiny.com/2009/09/javascript-scrollable-div/

I think your html is not correct. Try something like :

<div id="wrapper_1">

<div id="scroll_1">
    <div id="scrollcontent_1">
        <h1>TinyScroller</h1>
        <p>test message</p>
    </div>
    <div id="scrollbar_1">
        <div id="scroller"></div>
    </div>
</div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.