use transition on ::-webkit-scrollbar?

后端 未结 5 687
野的像风
野的像风 2021-02-02 09:06

is it possible to use transitions on webkit scrollbars? I tried:

div#main::-webkit-scrollbar-thumb {
    background: rgba(255,204,102,0.25);
    -webkit-transiti         


        
5条回答
  •  梦谈多话
    2021-02-02 09:53

    It is fairly easy to achieve using Mari M's background-color: inherit; technique in addition with -webkit-background-clip: text;.

    Live demo; https://jsfiddle.net/s10f04du/

    @media screen and (-webkit-min-device-pixel-ratio:0) { 
      .container {
        overflow-y: scroll;
        overflow-x: hidden;
        background-color: rgba(0,0,0,0);
        -webkit-background-clip: text;
        transition: background-color .8s;
      }
      .container:hover {
        background-color: rgba(0,0,0,0.18);  
      }
      .container::-webkit-scrollbar-thumb {
        background-color: inherit;
      }
    }
    

提交回复
热议问题