游戏设计师让我使用自定义向上和向下按钮以及自定义滚动条创建滚动条(不是通过谷歌浏览器在Windows上从浏览器本机提供的滚动条)
我尝试了如下,但我如何删除div内的原生卷轴?在div之外使用我自己的外观和感觉垂直滚动条,它可以与我现有的div交互?
.FixedHeightContainer {
height: 250px;
width:250px;
padding:3px;
background:#f00;
}
.Content {
height:224px;
overflow:auto;
background:#fff;
}

<span>UP</span>
<br/>
<div class="FixedHeightContainer">
<h2>Title</h2>
<div class="Content">
Game UI sucks<Br/>
Game UI i hate it, nightmare for programmers<Br/>
Game UI is hard<Br/>
Game UI<Br/>
Game UI<Br/>
Game UI<Br/>
Game UI<Br/>
Game UI<Br/>
Game UI<Br/>
Game UI<Br/>
Game UI<Br/>
Game UI<Br/>
Game UI<Br/>
Game UI<Br/>
Game UI<Br/>
Game UI<Br/>
</div>
</div>
<Br/>
<span>DOWN</span>
&#13;
答案 0 :(得分:2)
请参阅以下链接。对于与自定义滚动条相关的所有查询,它是一站式解决方案。
编辑: View Demo
/* For the "inset" look only */
html {
overflow: auto;
}
body {
position: absolute;
top: 20px;
left: 20px;
bottom: 20px;
right: 20px;
padding: 30px;
overflow-y: scroll;
overflow-x: hidden;
}
/* FAT or SLIM? */
::-webkit-scrollbar {
width: 12px;
}
/* Slider bar */
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
-webkit-border-radius: 10px;
border-radius: 10px;
}
/* Button inside the slider */
::-webkit-scrollbar-thumb {
-webkit-border-radius: 10px;
border-radius: 10px;
background: rgba(255,0,0,0.8);
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
}
::-webkit-scrollbar-thumb:window-inactive {
background: rgba(255,0,0,0.4);
}