- fixed indentation (2 spaces)
- added missing new lines at the end of files - removed 'ps-theme-big-and-ugly' theme - improved readme.md. Added an example on how to create custom themes with scss.
This commit is contained in:
parent
6fbaa00403
commit
bcfe954803
28
README.md
28
README.md
@ -309,7 +309,7 @@ The number of pixels the content height can surpass the container height without
|
|||||||
**Default: 0**
|
**Default: 0**
|
||||||
|
|
||||||
### stopPropagationOnClick
|
### stopPropagationOnClick
|
||||||
When set to false, when clicking on a rail, the click event will be allowed to propagate.
|
When set to false, when clicking on a rail, the click event will be allowed to pr##opagate.
|
||||||
**Default: true**
|
**Default: true**
|
||||||
|
|
||||||
### useSelectionScroll
|
### useSelectionScroll
|
||||||
@ -317,29 +317,35 @@ When set to true, you can scroll the container by selecting text and move the cu
|
|||||||
**Default: false**
|
**Default: false**
|
||||||
|
|
||||||
### theme
|
### theme
|
||||||
A string. It's a class name added to the container element. The class name is prepended with `ps-theme-`. So default theme class name is `ps-theme-default`. In order to create custom themes with scss use `ps-container($theme)` mixin, where `$theme` is a scss map. Look at `themes.scss` as a reference for how to create custom themes.
|
A string. It's a class name added to the container element. The class name is prepended with `ps-theme-`. So default theme class name is `ps-theme-default`. In order to create custom themes with scss use `ps-container($theme)` mixin, where `$theme` is a scss map.
|
||||||
**Default: 'default'**
|
**Default: 'default'**
|
||||||
|
|
||||||
Example:
|
**Example 1:**
|
||||||
|
|
||||||
|
Add `theme` parameter:
|
||||||
```javascript
|
```javascript
|
||||||
Ps.initialize(container, {
|
Ps.initialize(container, {
|
||||||
theme: 'my-theme-name',
|
theme: 'my-theme-name'
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
Create a class name prefixed with `.ps-theme-`. Include `ps-container()` mixin. It's recommended to use `map-merge()` to extend `$ps-theme-default` map with your custom styles.
|
||||||
```css
|
```css#
|
||||||
.ps-theme-my-theme-name {
|
.ps-theme-my-theme-name {
|
||||||
@include ps-container(map-merge($ps-theme-default, (
|
@include ps-container(map-merge($ps-theme-default, (
|
||||||
border-radius: 0,
|
border-radius: 0,
|
||||||
scrollbar-x-rail-height: 20px,
|
scrollbar-x-rail-height: 20px,
|
||||||
scrollbar-x-height: 20px,
|
scrollbar-x-height: 20px,
|
||||||
scrollbar-y-rail-width: 20px,
|
scrollbar-y-rail-width: 20px,
|
||||||
scrollbar-y-width: 20px,)
|
scrollbar-y-width: 20px,)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Example 2:**
|
||||||
|
|
||||||
|
Alternatively, if you don't want to create your own themes, but only modify the default one, you could simply overwrite `$ps-*` variables with your own values. In this case `theme` parameter is not required when calling `.initialize()` method. Remember do define your own variables before the `theme.scss` file is imported.
|
||||||
|
|
||||||
|
|
||||||
## Events
|
## Events
|
||||||
|
|
||||||
perfect-scrollbar dispatches custom events.
|
perfect-scrollbar dispatches custom events.
|
||||||
|
@ -1,30 +1,27 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||||
<title>perfect-scrollbar example</title>
|
<title>perfect-scrollbar example</title>
|
||||||
<link href="../dist/css/perfect-scrollbar.css" rel="stylesheet">
|
<link href="../dist/css/perfect-scrollbar.css" rel="stylesheet">
|
||||||
<script src="../dist/js/perfect-scrollbar.js"></script>
|
<script src="../dist/js/perfect-scrollbar.js"></script>
|
||||||
<style>
|
<style>
|
||||||
.contentHolder { position:relative; margin:0px auto; padding:0px; width: 600px; height: 400px; overflow: auto; }
|
.contentHolder { position:relative; margin:0px auto; padding:0px; width: 600px; height: 400px; overflow: auto; }
|
||||||
.contentHolder .content { background-image: url('./azusa.jpg'); width: 1280px; height: 720px; }
|
.contentHolder .content { background-image: url('./azusa.jpg'); width: 1280px; height: 720px; }
|
||||||
.spacer { text-align:center }
|
</style>
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="Default" class="contentHolder">
|
<div id="Default" class="contentHolder">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var $ = document.querySelector.bind(document);
|
var $ = document.querySelector.bind(document);
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
Ps.initialize($('#Default'), {
|
Ps.initialize($('#Default'), {
|
||||||
theme: 'big-and-ugly'
|
theme: 'big-and-ugly'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
@import 'variables';
|
@import 'variables';
|
||||||
@import 'mixins';
|
@import 'mixins';
|
||||||
@import 'themes';
|
@import 'themes';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Helper mixins TODO: get rid of these mixins: https://github.com/noraesae/perfect-scrollbar/issues/431
|
// Helper mixins
|
||||||
@mixin border-radius($r) {
|
@mixin border-radius($r) {
|
||||||
-webkit-border-radius: $r;
|
-webkit-border-radius: $r;
|
||||||
-moz-border-radius: $r;
|
-moz-border-radius: $r;
|
||||||
@ -117,4 +117,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,34 +1,23 @@
|
|||||||
$ps-theme-default: (
|
$ps-theme-default: (
|
||||||
border-radius: $ps-border-radius,
|
border-radius: $ps-border-radius,
|
||||||
rail-default-opacity: $ps-rail-default-opacity,
|
rail-default-opacity: $ps-rail-default-opacity,
|
||||||
rail-container-hover-opacity: $ps-rail-container-hover-opacity,
|
rail-container-hover-opacity: $ps-rail-container-hover-opacity,
|
||||||
rail-hover-opacity: $ps-rail-hover-opacity,
|
rail-hover-opacity: $ps-rail-hover-opacity,
|
||||||
bar-bg: $ps-bar-bg,
|
bar-bg: $ps-bar-bg,
|
||||||
bar-container-hover-bg: $ps-bar-container-hover-bg,
|
bar-container-hover-bg: $ps-bar-container-hover-bg,
|
||||||
bar-hover-bg: $ps-bar-hover-bg,
|
bar-hover-bg: $ps-bar-hover-bg,
|
||||||
rail-hover-bg: $ps-rail-hover-bg,
|
rail-hover-bg: $ps-rail-hover-bg,
|
||||||
scrollbar-x-rail-bottom: $ps-scrollbar-x-rail-bottom,
|
scrollbar-x-rail-bottom: $ps-scrollbar-x-rail-bottom,
|
||||||
scrollbar-x-rail-height: $ps-scrollbar-x-rail-height,
|
scrollbar-x-rail-height: $ps-scrollbar-x-rail-height,
|
||||||
scrollbar-x-bottom: $ps-scrollbar-x-bottom,
|
scrollbar-x-bottom: $ps-scrollbar-x-bottom,
|
||||||
scrollbar-x-height: $ps-scrollbar-x-height,
|
scrollbar-x-height: $ps-scrollbar-x-height,
|
||||||
scrollbar-y-rail-right: $ps-scrollbar-y-rail-right,
|
scrollbar-y-rail-right: $ps-scrollbar-y-rail-right,
|
||||||
scrollbar-y-rail-width: $ps-scrollbar-y-rail-width,
|
scrollbar-y-rail-width: $ps-scrollbar-y-rail-width,
|
||||||
scrollbar-y-right: $ps-scrollbar-y-right,
|
scrollbar-y-right: $ps-scrollbar-y-right,
|
||||||
scrollbar-y-width: $ps-scrollbar-y-width,
|
scrollbar-y-width: $ps-scrollbar-y-width,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Default theme
|
// Default theme
|
||||||
.ps-container {
|
.ps-container {
|
||||||
@include ps-container($ps-theme-default);
|
@include ps-container($ps-theme-default);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Example theme
|
|
||||||
.ps-theme-big-and-ugly {
|
|
||||||
@include ps-container(map-merge($ps-theme-default, (
|
|
||||||
border-radius: 0,
|
|
||||||
scrollbar-x-rail-height: 20px,
|
|
||||||
scrollbar-x-height: 20px,
|
|
||||||
scrollbar-y-rail-width: 20px,
|
|
||||||
scrollbar-y-width: 20px,)
|
|
||||||
));
|
|
||||||
}
|
|
@ -19,4 +19,4 @@ $ps-scrollbar-x-height: 8px !default;
|
|||||||
$ps-scrollbar-y-rail-right: 3px !default;
|
$ps-scrollbar-y-rail-right: 3px !default;
|
||||||
$ps-scrollbar-y-rail-width: 8px !default;
|
$ps-scrollbar-y-rail-width: 8px !default;
|
||||||
$ps-scrollbar-y-right: 0 !default;
|
$ps-scrollbar-y-right: 0 !default;
|
||||||
$ps-scrollbar-y-width: 8px !default;
|
$ps-scrollbar-y-width: 8px !default;
|
||||||
|
Loading…
Reference in New Issue
Block a user