代码之家  ›  专栏  ›  技术社区  ›  Dan Appleyard

DIV滚动条-有什么风格吗?

  •  22
  • Dan Appleyard  · 技术社区  · 16 年前

    是否仍要控制DIV标记滚动条的样式?我在IE7和火狐3.5.2之间遇到了一些对比问题。任何帮助都将不胜感激!

    5 回复  |  直到 12 年前
        1
  •  28
  •   Logesh Paul    16 年前

    使用javascript,您可以设置滚动条的样式。在IE和FF中都可以正常工作。

    检查以下链接

    From Twinhelix , Example 2 , Example 3 [或]单击下面的链接,可以找到大约30种滚动样式类型 30 scrolling techniques

        2
  •  2
  •   Daniel A. White    16 年前

    不,你不能在火狐、Safari等浏览器中使用。你可以在Internet Explorer中使用。有几个脚本可以让你制作一个滚动条。

        3
  •  2
  •   Marco Demaio    14 年前

    This one does well its scrolling job . 它很容易理解,只需要几行代码,写得好,完全可读。

        4
  •  2
  •   Rodrigo Moraes    12 年前

    在网上,我找到了一些简单的设计滚动条样式的方法。

    这就是那个人! http://almaer.com/blog/creating-custom-scrollbars-with-css-how-css-isnt-great-for-every-task

    这里是我的实现! https://dl.dropbox.com/u/1471066/cloudBI/cssScrollbars.png

    /* Turn on a 13x13 scrollbar */
    ::-webkit-scrollbar {
        width: 10px;
        height: 13px;
    }
    
    ::-webkit-scrollbar-button:vertical {
        background-color: silver;
        border: 1px solid gray;
    }
    
    /* Turn on single button up on top, and down on bottom */
    ::-webkit-scrollbar-button:start:decrement,
    ::-webkit-scrollbar-button:end:increment {
        display: block;
    }
    
    /* Turn off the down area up on top, and up area on bottom */
    ::-webkit-scrollbar-button:vertical:start:increment,
    ::-webkit-scrollbar-button:vertical:end:decrement {
        display: none;
    }
    
    /* Place The scroll down button at the bottom */
    ::-webkit-scrollbar-button:vertical:increment {
        display: none;
    }
    
    /* Place The scroll up button at the up */
    ::-webkit-scrollbar-button:vertical:decrement {
        display: none;
    }
    
    /* Place The scroll down button at the bottom */
    ::-webkit-scrollbar-button:horizontal:increment {
        display: none;
    }
    
    /* Place The scroll up button at the up */
    ::-webkit-scrollbar-button:horizontal:decrement {
        display: none;
    }
    
    ::-webkit-scrollbar-track:vertical {
        background-color: blue;
        border: 1px dashed pink;
    }
    
    /* Top area above thumb and below up button */
    ::-webkit-scrollbar-track-piece:vertical:start {
        border: 0px;
    }
    
    /* Bottom area below thumb and down button */
    ::-webkit-scrollbar-track-piece:vertical:end {
        border: 0px;
    }
    
    /* Track below and above */
    ::-webkit-scrollbar-track-piece {
        background-color: silver;
    }
    
    /* The thumb itself */
    ::-webkit-scrollbar-thumb:vertical {
        height: 50px;
        background-color: gray;
    }
    
    /* The thumb itself */
    ::-webkit-scrollbar-thumb:horizontal {
        height: 50px;
        background-color: gray;
    }
    
    /* Corner */
    ::-webkit-scrollbar-corner:vertical {
        background-color: black;
    }
    
    /* Resizer */
    ::-webkit-scrollbar-resizer:vertical {
        background-color: gray;
    }
    
        5
  •  0
  •   rmarscher    13 年前

    还有一个iscroll项目,它允许您设置滚动条的样式,并让它与触摸设备一起工作。 http://cubiq.org/iscroll-4