SitePoint Sponsor

User Tag List

Results 1 to 15 of 15

Thread: DIV scroll area with custom scroll bars

  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    Cape Town, SA
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DIV scroll area with custom scroll bars

    I'm looking for a script that does something exactly like this....
    http://www.dyn-web.com/dhtml/scroll/scroll-rel.html
    I'd use this one except, I think the code is quite bloated and a little too heavy for my liking.

    I've been looking around, and I can't find a light-weight version that allows the scroll bar to be dragged - that's all I want, don't need the arrows.

    If anyone knows any off the top of their heads, that'd be great

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Portsmouth UK
    Posts
    1,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    there a number of elements to construct so code may seem large if constructed using DOM.

    code may be be smaller if HTML code used.

    will have a look tomorrow

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2005
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This scrollbar is very good looking, but it is very annoying for the user.

    Me personnaly, have abandoned a frequently used news site because they have changed their layout to a scrolling frame with a scrollbar like this.

    First it was fun. 5 min. later it was boring. The next day I just gave up, and went to the next news site.

  4. #4
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,481
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I agree with SUPERUSER -- use the normal scrollbars.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  5. #5
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    Cape Town, SA
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SUPERUSER your're assuming this is for a news site, which it isn't. Otherwise I'd totally agree with you.

    vwphillips - I realise it's gonna be fairly complex, I'm just pretty sure the code could be smaller than the code in the example I gave. If not, I'll probably end up going with regular scrollbars.

  6. #6
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,481
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It doesn't matter what kind of site it is. SUPERUSER just used the news site as an example.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  7. #7
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I would imagine that all !IE browsers will follow suit and let you style the scrollbars in the near future. It is such a wanted and used function.
    Here's the javascript that will let you do it in IE, but you need a browser detector
    Code:
    if(ie){
    bodyStyle=document.body.style;
    bodyStyle.scrollbarTrackColor="#EBCD8C";
    bodyStyle.scrollbarArrowColor="#FaFaFa";
    bodyStyle.scrollbarFaceColor="#D8C59D";
    bodyStyle.scrollbarHighlightColor="#fafafa";
    bodyStyle.scrollbar3dlightColor="#fafafa";
    bodyStyle.scrollbarDarkshadowColor="#B99346";
    bodyStyle.scrollbarShadowColor="#B99346";
    }
    It can be doen using CSS but it stops the stylesheets from validating.

    If you want to apply the colored scrollbars to the page rather than the body you will need to style the scrollbrs of the <html> element. eg
    Code:
    <style type="text/css">
    html,body{scrollbar-track-color:#EBCD8C;}
    </style>
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  8. #8
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,481
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe, but then again, maybe not.

    Anyway, scrollbar colors are optional in newer versions of Opera.
    http://www.opera.com/support/search/....dml?index=637
    http://www.quirksmode.org/css/scrollbars.html
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  9. #9
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    Cape Town, SA
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Markdidj, but I'm not looking to use the normal built in scroll bar, but rather create one myself out of javascript - as per the example I gave, since it uses minimal real-estate and will look the same in every browser.

  10. #10
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,481
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Trying to make pixel perfect, cross-browser/platform sites is a waste of time.

    That script that you linked to is rather glitchy in Netscape 6.x and doesn't really work at all in Opera 6.x, now even though those versions are a few years old, there may still be a few people who have neglected to upgrade.

    Scrollbar scripts are just not very accessible. What happens if someone has JavaScript disabled? Well that script does not degrade gracefully, meaning that that page is basically useless when JavaScript is not enabled.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  11. #11
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    Cape Town, SA
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, Kravvitz, after looking around some more - I've decided to abandon that idea. Besides the problems you mentioned, it's just always gonna be too heavy. Just gonna have to re-think my options.

  12. #12
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I wonder why the other browsers don't allow such scrollbar styling? It's asked for so many times, for such a long time, and is a suberb feature. IE rocks IMO, although it has problems with ActiveX, which after time will be fixed, it has so many extra features when it comes to styling and sound.

    Kravvitz, is that Opera function detectable? I think using the javascript will throw an error, unless I use it in the css or javascript written css.
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  13. #13
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,481
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And yet IE lacks support for so much CSS2...

    Some people are of the opinion that developers should not use scrollbar colors, which may be part of why they haven't been added to the Mozilla Gecko engine.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  14. #14
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    andyweb, it can be used, but you'll be better off using some noscript anchors to show the bits that are unreachable when js is turned off. see the web or forum sections at my homepage. The pics are the anchor links, and the info is in a scrolling area with the scrollbars hidden.
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  15. #15
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,481
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Markdidj
    Kravvitz, is that Opera function detectable? I think using
    the javascript will throw an error, unless I use it in the css or javascript
    written css.
    I missed this before.

    For Opera 7.20+, when in Standards Compliance mode, Opera only supports scrollbar-*-color when they are used inline on elements other than <body> and <html>. In quirks mode, Opera supports them in embedded and linked stylesheets as well as inline on <body>. Unlike IE5.5+, Opera doesn't support manipulating them through <objectRef>.style.scrollbar******Color at all.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •