perf: 优化滚动条

This commit is contained in:
kuaifan 2022-12-04 14:59:31 +08:00
parent 19fa164c75
commit 0c1ec83796

View File

@ -1,24 +1,32 @@
/* 滚动条美化 */
.scrollbar-overlay { .scrollbar-overlay {
overflow-y: auto; overflow-y: auto;
overflow-y: overlay; overflow-y: overlay;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
/* 滚动条美化 */ /* 滚动条尺寸 */
&::-webkit-scrollbar { &::-webkit-scrollbar {
width: 12px; width: 0;
height: 12px; height: 0;
} }
/*滚动条滑块隐藏*/ /*滚动条滑块隐藏*/
&::-webkit-scrollbar-thumb { &::-webkit-scrollbar-thumb {
border: 3px solid transparent;
background-color: rgba(0, 0, 0, .2);
background-clip: content-box;
border-radius: 12px; border-radius: 12px;
background: rgba(0, 0, 0, 0); /*让该容器的滚动条滑块显示*/
} &:hover {
border: 2px solid transparent;
background-color: rgba(0, 0, 0, .2);
}
/*按下滚动条,颜色加深*/ /*按下滚动条,颜色加深*/
&::-webkit-scrollbar-thumb:active { &:active {
border-radius: 12px; border: 2px solid transparent;
background: rgba(0, 0, 0, .5); background-color: rgba(0, 0, 0, .4);
}
} }
/*滚动条轨道*/ /*滚动条轨道*/
@ -29,29 +37,14 @@
/*鼠标浮到容器上*/ /*鼠标浮到容器上*/
&:hover { &:hover {
/*让该容器的滚动条滑块显示*/ &::-webkit-scrollbar {
&::-webkit-scrollbar-thumb { width: 12px;
border: 3px solid transparent; height: 12px;
background: rgba(0, 0, 0, .2);
background-clip: content-box;
}
/*让该容器的滚动条滑块显示*/
&::-webkit-scrollbar-thumb:hover {
border: 2px solid transparent;
background: rgba(0, 0, 0, .2);
background-clip: content-box;
}
/*按下滚动条,颜色加深*/
&::-webkit-scrollbar-thumb:active {
border: 2px solid transparent;
background: rgba(0, 0, 0, .5);
background-clip: content-box;
} }
} }
} }
/* 滚动条隐藏 */
.scrollbar-hidden { .scrollbar-hidden {
&::-webkit-scrollbar { &::-webkit-scrollbar {
display: none; display: none;