├── assets
└── img
│ └── share.png
├── src
├── js
│ ├── main.js
│ └── components
│ │ ├── app.vue
│ │ ├── vertical-scrollbar.vue
│ │ ├── horizontal-scrollbar.vue
│ │ └── vue-scrollbar.vue
└── sass
│ ├── main.sass
│ └── _Scrollbar.sass
├── webpack.config.js
├── LICENSE
├── package.json
├── README.md
└── index.html
/assets/img/share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BosNaufal/vue-scrollbar/HEAD/assets/img/share.png
--------------------------------------------------------------------------------
/src/js/main.js:
--------------------------------------------------------------------------------
1 |
2 | var Vue = require('vue');
3 | var App = require('./components/app.vue');
4 |
5 | Vue.config.debug = true;
6 | Vue.config.devTools = true;
7 |
8 | new Vue({
9 | el: 'body',
10 | components: { App: App }
11 | });
12 |
--------------------------------------------------------------------------------
/src/sass/main.sass:
--------------------------------------------------------------------------------
1 |
2 | body
3 | background: #f9f9f9
4 |
5 | p
6 | margin-top: 0
7 |
8 | .my-scrollbar
9 | width: 35%
10 | min-width: 300px
11 | max-height: 450px
12 |
13 | .scroll-me
14 | background: #EEE
15 | min-width: 750px
16 |
17 | .kolom
18 | background: #2196F3
19 | width: 150px
20 | height: 150px
21 | float: left
22 | display: inline-block
23 | margin: 15px
24 |
25 | .clearfix
26 | clear: both
27 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 |
2 | require('es6-promise').polyfill();
3 |
4 | module.exports = {
5 |
6 | entry: './src/js/main.js',
7 |
8 | output: {
9 | path: './build',
10 | filename: 'build.js'
11 | },
12 |
13 | module: {
14 | loaders: [
15 | {
16 | test: /\.vue$/,
17 | loader: 'vue'
18 | },
19 | {
20 | test: /\.sass$/,
21 | loaders: ['style','css','sass']
22 | }
23 | ]
24 | }
25 |
26 | };
27 |
--------------------------------------------------------------------------------
/src/js/components/app.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | div
5 | h1( align="center") Vue Scrollbar
6 | vue-scrollbar( classes="my-scrollbar" v-bind:speed=53 )
7 | .scroll-me
8 | .kolom
9 | .kolom
10 | .kolom
11 | .kolom
12 | .kolom
13 | .kolom
14 | .kolom
15 | .kolom
16 | .kolom
17 | .kolom
18 | .kolom
19 | .kolom
20 | .kolom
21 | .kolom
22 | .kolom
23 | .kolom
24 | .kolom
25 | .kolom
26 | .kolom
27 | .kolom
28 | .clearfix
29 | br
30 | br
31 | h3( align="center" )
32 | a( href="https://github.com/BosNaufal/vue-scrollbar" ) Fork Me On Github!
33 |
34 |
35 |
46 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Naufal Rabbani
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/sass/_Scrollbar.sass:
--------------------------------------------------------------------------------
1 |
2 |
3 | .vue-scrollbar-transition
4 | transition: all 0.5s ease
5 | -moz-transition: all 0.5s ease
6 | -webkit-transition: all 0.5s ease
7 | -o-transition: all 0.5s ease
8 |
9 | &--scrollbar
10 | transition: opacity 0.5s linear
11 | -moz-transition: opacity 0.5s linear
12 | -webkit-transition: opacity 0.5s linear
13 | -o-transition: opacity 0.5s linear
14 |
15 | .vue-scrollbar
16 | &__wrapper
17 | margin: 0 auto
18 | overflow: hidden
19 | position: relative
20 | background: white
21 |
22 | &:hover
23 | .vue-scrollbar
24 | &__scrollbar-vertical, &__scrollbar-horizontal
25 | opacity: 1
26 |
27 |
28 | &__scrollbar-vertical, &__scrollbar-horizontal
29 | @extend .vue-scrollbar-transition
30 | opacity: 0.5
31 | position: absolute
32 | background: transparent
33 |
34 | &:hover
35 | background: rgba(0,0,0,0.3)
36 |
37 | .scrollbar
38 | position: relative
39 | background: rgba(0,0,0,0.5)
40 | cursor: default
41 |
42 | &__scrollbar-vertical
43 | width: 10px
44 | height: 100%
45 | top: 0
46 | right: 0
47 |
48 | .scrollbar
49 | width: 10px
50 |
51 | &__scrollbar-horizontal
52 | height: 10px
53 | width: 100%
54 | bottom: 0
55 | right: 0
56 |
57 | .scrollbar
58 | height: 10px
59 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-scrollbar",
3 | "version": "1.0.3",
4 | "description": "The Simplest Scroll Area Component with custom scrollbar for Vue JS",
5 | "main": "./src/js/components/vue-scrollbar.vue",
6 | "scripts": {
7 | "dev": "webpack-dev-server --inline --hot",
8 | "build": "webpack -p"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "git+https://github.com/BosNaufal/vue-scrollbar.git"
13 | },
14 | "keywords": [
15 | "vue",
16 | "component",
17 | "web-components",
18 | "vue js",
19 | "scrollbar",
20 | "scroll",
21 | "scrollbar effect",
22 | "smooth scroll",
23 | "custom scrollbar",
24 | "slimscroll",
25 | "web-components"
26 | ],
27 | "author": "Naufal Rabbani ",
28 | "license": "MIT",
29 | "bugs": {
30 | "url": "https://github.com/BosNaufal/vue-scrollbar/issues"
31 | },
32 | "homepage": "https://github.com/BosNaufal/vue-scrollbar#readme",
33 | "devDependencies": {
34 | "babel-loader": "^6.2.4",
35 | "babel-preset-es2015": "^6.6.0",
36 | "css-loader": "^0.23.1",
37 | "es6-promise": "^3.1.2",
38 | "jade-loader": "^0.8.0",
39 | "sass-loader": "^3.2.0",
40 | "style-loader": "^0.13.1",
41 | "vue-hot-reload-api": "^1.3.2",
42 | "vue-html-loader": "^1.2.2",
43 | "vue-loader": "^8.2.3",
44 | "webpack": "^1.13.0",
45 | "webpack-dev-server": "^1.14.1"
46 | },
47 | "dependencies": {
48 | "vue": "^1.0.21"
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Vue Scrollbar
2 |
3 | The Simplest Scroll Area Component with custom scrollbar for [Vue Js](http://vuejs.org/). All animation, Height and Width are pure CSS, So it's TOTALLY **CUSTOMIZABLE** and **RESPONSIVE**! YEAH!.
4 |
5 | [DEMO](https://bosnaufal.github.io/vue-scrollbar)
6 |
7 | ## Install
8 | You can import [vue-scrollbar.vue](./src/js/components/vue-scrollbar.vue) to your vue component file like [this](./src/js/components/app.js) and process it with your preprocessor.;
9 |
10 |
11 | You can install it via NPM
12 | ```bash
13 | npm install vue-scrollbar
14 | ```
15 |
16 |
17 | ## Usage
18 | ```html
19 |
20 |
21 |
22 |
27 |
28 |
29 |
30 |
39 | ```
40 |
41 |
42 | ## Props
43 | ##### clasess (String)
44 | Just the ordinary class name for styling the wrapper. It's TOTALLY CUSTOMIZABLE!
45 | ```css
46 | /*The Wrapper*/
47 | .my-scrollbar{
48 | width: 35%;
49 | min-width: 300px;
50 | max-height: 450px;
51 | }
52 |
53 | /*The Content*/
54 | .scroll-me{
55 | min-width: 750px;
56 | }
57 | ```
58 |
59 | ##### speed (Number)
60 | The wheel step in pixel. The default is 53 pixel per wheel.
61 |
62 | ## Thank You for Making this useful~
63 |
64 | ## Let's talk about some projects with me
65 | Just Contact Me At:
66 | - Email: [bosnaufalemail@gmail.com](mailto:bosnaufalemail@gmail.com)
67 | - Skype Id: bosnaufal254
68 | - twitter: [@BosNaufal](https://twitter.com/BosNaufal)
69 |
70 | ## License
71 | [MIT](http://opensource.org/licenses/MIT)
72 | Copyright (c) 2016 - forever Naufal Rabbani
73 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Vue Scrollbar | The Simplest Scroll Area Component with custom scrollbar for Vue Js.
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/js/components/vertical-scrollbar.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | .vue-scrollbar__scrollbar-vertical( v-if="height < 100" @click="jump" v-el:container )
5 | .scrollbar(
6 | v-bind:class="dragging || draggingFromParent ? '' : 'vue-scrollbar-transition'"
7 | v-el:scrollbar
8 | @touchstart="startDrag"
9 | @mousedown="startDrag"
10 | v-bind:style="{ height: height+'%', top: scrolling.v + '%' }"
11 | )
12 |
13 |
14 |
15 |
164 |
--------------------------------------------------------------------------------
/src/js/components/horizontal-scrollbar.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | .vue-scrollbar__scrollbar-horizontal( v-if="width < 100" @click="jump" v-el:container )
5 | .scrollbar(
6 | v-bind:class="dragging || draggingFromParent ? '' : 'vue-scrollbar-transition'"
7 | v-el:scrollbar
8 | @touchstart="startDrag"
9 | @mousedown="startDrag"
10 | v-bind:style="{ width: width+'%', left: scrolling.h + '%' }"
11 | )
12 |
13 |
14 |
15 |
165 |
--------------------------------------------------------------------------------
/src/js/components/vue-scrollbar.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | .vue-scrollbar__wrapper(
4 | v-el:scroll-wrapper
5 | v-bind:class="classes ? ' ' + classes : ''")
6 | .vue-scrollbar__area(
7 | @wheel="scroll"
8 | v-el:scroll-area
9 | @touchstart="startDrag"
10 | @touchmove="onDrag"
11 | @touchend="stopDrag"
12 | v-bind:class="(dragging ? '' : 'vue-scrollbar-transition')"
13 | v-bind:style="{ 'margin-top': top * -1 +'px', 'margin-left': left * -1 +'px' }"
14 | )
15 |
16 | slot
17 |
18 | vertical-scrollbar(
19 | v-if="ready"
20 | v-bind:area="{ height: scrollAreaHeight }"
21 | v-bind:wrapper="{ height: scrollWrapperHeight }"
22 | v-bind:scrolling="{ v: vMovement }"
23 | v-bind:dragging-from-parent="dragging"
24 | v-bind:on-change-position="handleChangePosition"
25 | )
26 |
27 | horizontal-scrollbar(
28 | v-if="ready"
29 | v-bind:area="{ width: scrollAreaWidth }"
30 | v-bind:wrapper="{ width: scrollWrapperWidth }"
31 | v-bind:scrolling="{ h: hMovement }"
32 | v-bind:dragging-from-parent="dragging"
33 | v-bind:on-change-position="handleChangePosition"
34 | )
35 |
36 |
37 |
38 |
41 |
42 |
251 |
--------------------------------------------------------------------------------