美文网首页
-webkit-scrollbar

-webkit-scrollbar

作者: igor_d140 | 来源:发表于2019-01-17 00:27 被阅读16次
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>scrollbar</title>
  <style>
  body{
    padding: 0;
    margin: 0;
  }
    .scrollbar{
      height: 50vh;
      overflow-x: hidden;
      overflow-y: scroll;
      /*opacity: 0.5;*/
     
    }
    .scrollbar::-webkit-scrollbar{
      border: 0;
      display: none;
    /*  width: 10px;
      height: 20px;
      display: block;
      background-color: #eee;
      opacity: 0.4;
       position: absolute;
      z-index: 99;
      left: 0;*/
    }
/*    .scrollbar::-webkit-scrollbar-button{
      background-color: #000;
      width: 20px;
      height: 22px;
      cursor: wait;
    }*/
    .scrollbar:hover::-webkit-scrollbar{
      width: 10px;
      display: block;
      background-color: transparent;
    }
    .scrollbar::-webkit-scrollbar-thumb{
      background-color: #eee;
      width: 20px;
      height: 22px;
      cursor: wait;
    }
    .scrollbar::-webkit-scrollbar-track{
      position: absolute;
      z-index: -1;
      /*width: 1px;*/
      /*width: 20px;*/
      /*background-color: rgba(0, 0, 0, 0.4);*/
      /*opacity: 0.5;*/
    /*  position: absolute;
      z-index: 99;
      left: 0;
      top: 20px;*/
    }
    p {
      background-color: #666;
      color: #fff;
    }
  </style>
</head>
<body>
</body>
<script>
  const target = document.querySelector('body')
  let html = '<div class="scrollbar">', i =0;
  // for(let i = 0; i < 50; i++)
  while(i++ < 50) {
    console.log(i)
    html += `<p>test-----${i}-------</p>`
  }
  target.innerHTML = html + '</div>'
</script>
</html>

相关文章

网友评论

      本文标题:-webkit-scrollbar

      本文链接:https://www.haomeiwen.com/subject/ekcbdqtx.html