Skip to content

Instantly share code, notes, and snippets.

@ShenTengTu
Created July 26, 2017 13:20
Show Gist options
  • Save ShenTengTu/4f6edd45ec7a48c3d18b862254cfad97 to your computer and use it in GitHub Desktop.
Save ShenTengTu/4f6edd45ec7a48c3d18b862254cfad97 to your computer and use it in GitHub Desktop.
all scss file in noraesae's perfect-scrollbar(v7.0.1) to one less file
/*=====perfect-scrollbar=====*/
/*--variables---*/
@ps-border-radius: 6px;
@ps-rail-default-opacity: 0;
@ps-rail-container-hover-opacity: 0.6;
@ps-rail-hover-opacity: 0.9;
@ps-bar-bg: transparent;
@ps-bar-container-hover-bg: #aaa;
@ps-bar-hover-bg: #999;
@ps-rail-hover-bg: #eee;
// Sizes
@ps-scrollbar-x-rail-bottom: 0px;
@ps-scrollbar-x-rail-height: 15px;
@ps-scrollbar-x-bottom: 2px;
@ps-scrollbar-x-height: 6px;
@ps-scrollbar-x-hover-height: 11px;
@ps-scrollbar-y-rail-right: 0;
@ps-scrollbar-y-rail-width: 15px;
@ps-scrollbar-y-right: 2px;
@ps-scrollbar-y-width: 6px;
@ps-scrollbar-y-hover-width: 11px;
/*--Mixins---*/
.scrollbar-rail-default() {
display: none;
position: absolute; /* please don't change 'position' */
opacity: @rail-default-opacity;
transition: background-color .2s linear, opacity .2s linear;
}
.scrollbar-rail-hover() {
background-color: @rail-hover-bg;
opacity: @rail-hover-opacity;
}
.scrollbar-default() {
position: absolute; /* please don't change 'position' */
background-color: @bar-container-hover-bg;
border-radius: @border-radius;
transition: background-color .2s linear, height .2s linear, width .2s ease-in-out,
border-radius .2s ease-in-out;
}
.scrollbar-hover() {
background-color: @bar-hover-bg;
}
.in-scrolling() {
&.ps--in-scrolling {
&.ps--x > .ps__scrollbar-x-rail {
.scrollbar-rail-hover();
> .ps__scrollbar-x {
.scrollbar-hover();
height: @scrollbar-x-hover-height;
}
}
&.ps--y > .ps__scrollbar-y-rail {
.scrollbar-rail-hover();
> .ps__scrollbar-y {
.scrollbar-hover();
width: @scrollbar-y-hover-width;
}
}
}
}
// Layout and theme mixin
.ps-container() {
-ms-touch-action: auto;
touch-action: auto;
overflow: hidden !important;
-ms-overflow-style: none;
// Edge
@supports (-ms-overflow-style: none) {
overflow: auto !important;
}
// IE10+
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
overflow: auto !important;
}
&.ps--active-x > .ps__scrollbar-x-rail,
&.ps--active-y > .ps__scrollbar-y-rail {
display: block;
background-color: @bar-bg;
}
.in-scrolling();
> .ps__scrollbar-x-rail {
.scrollbar-rail-default();
bottom: @scrollbar-x-rail-bottom; /* there must be 'bottom' for ps__scrollbar-x-rail */
height: @scrollbar-x-rail-height;
> .ps__scrollbar-x {
.scrollbar-default();
bottom: @scrollbar-x-bottom; /* there must be 'bottom' for ps__scrollbar-x */
height: @scrollbar-x-height;
}
&:hover,
&:active {
> .ps__scrollbar-x {
height: @scrollbar-x-hover-height;
}
}
}
> .ps__scrollbar-y-rail {
.scrollbar-rail-default();
right: @scrollbar-y-rail-right; /* there must be 'right' for ps__scrollbar-y-rail */
width: @scrollbar-y-rail-width;
> .ps__scrollbar-y {
.scrollbar-default();
right: @scrollbar-y-right; /* there must be 'right' for ps__scrollbar-y */
width: @scrollbar-y-width;
}
&:hover,
&:active {
> .ps__scrollbar-y {
width: @scrollbar-y-hover-width;
}
}
}
&:hover {
.in-scrolling();
> .ps__scrollbar-x-rail,
> .ps__scrollbar-y-rail {
opacity: @rail-container-hover-opacity;
}
> .ps__scrollbar-x-rail:hover {
.scrollbar-rail-hover();
> .ps__scrollbar-x {
.scrollbar-hover();
}
}
> .ps__scrollbar-y-rail:hover {
.scrollbar-rail-hover();
> .ps__scrollbar-y {
.scrollbar-hover();
}
}
}
}
/*--thems---*/
//default
.ps-theme-default(){
@border-radius: @ps-border-radius;
@rail-default-opacity: @ps-rail-default-opacity;
@rail-container-hover-opacity: @ps-rail-container-hover-opacity;
@rail-hover-opacity: @ps-rail-hover-opacity;
@bar-bg: @ps-bar-bg;
@bar-container-hover-bg: @ps-bar-container-hover-bg;
@bar-hover-bg: @ps-bar-hover-bg;
@rail-hover-bg: @ps-rail-hover-bg;
@scrollbar-x-rail-bottom: @ps-scrollbar-x-rail-bottom;
@scrollbar-x-rail-height: @ps-scrollbar-x-rail-height;
@scrollbar-x-bottom: @ps-scrollbar-x-bottom;
@scrollbar-x-height: @ps-scrollbar-x-height;
@scrollbar-x-hover-height: @ps-scrollbar-x-hover-height;
@scrollbar-y-rail-right: @ps-scrollbar-y-rail-right;
@scrollbar-y-rail-width: @ps-scrollbar-y-rail-width;
@scrollbar-y-right: @ps-scrollbar-y-right;
@scrollbar-y-width: @ps-scrollbar-y-width;
@scrollbar-y-hover-width: @ps-scrollbar-y-hover-width;
}
.ps {
.ps-theme-default();
.ps-container();
}
/*==========*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment