1.0.1 • Published 3 years ago

vue-fade-scrollbar v1.0.1

Weekly downloads
76
License
MIT
Repository
github
Last release
3 years ago

vue-fade-scrollbar

Wrapper component that replaces the element's own scrollbar. The new scrollbar can auto-hide on various media queries, appear on hover content and doesn't affect the content. See here the Demo

Installation

npm install --save vue-fade-scrollbar

or

yarn add vue-fade-scrollbar

Import

Global Registration

import Vue from 'vue'
import VueFadeScrollbar from "./VueFadeScrollbar"

Vue.component('vue-fade-scrollbar', VueFadeScrollbar)

In Component Registration:

<template>
  ...
</template>
<script>
import VueFadeScrollbar from 'vue-fade-scrollbar'

export default {
  name: 'ComponentName',
  components: {
    VueFadeScrollbar,
    ...
  },
  ...
}
</script>

Not Using Webpack

If you don't use webpack (for example in CodePen etc):

<link rel="stylesheet" href="node-modules/vue-fade-scrollbar/distvue-fade-scrollbar.css" />
<script src="node-modules/vue-fade-scrollbar/dist/vue-fade-scrollbar.umd.js"></script>

and then you still need to register it:

Vue.component('vue-fade-scrollbar', VueFadeScrollbar)

Basic Usage

<template>
  <VueFadeScrollbar :visible="mediaQuery">
    ...
  </VueFadeScrollbar>
</template>

<script>
    export default {
        data: {
            mediaQuery: 'm-down',
        },
    }
</script>

Props

  • visible (default: ''): media queries for scrollbar visibility

    namevalue
    xsmin-width: 375px
    smin-width: 480px
    mmin-width: 768px
    lmin-width: 1024px
    xlmin-width: 1440px
    xs-downmax-width: 374px
    s-downmax-width: 479px
    m-downmax-width: 767px
    l-downmax-width: 1023px
    xl-downmin-width: 1439px
    xl-downmax-width: 1439px
  • thumb (type: Object). Thumb properties:

    propertytypedefaultdescription
    thiknessstring10pxthumb width
    leftstring1pxthumb left indent inside the track
    rightstring1pxthumb right indent inside the track
    radiusstring0thumb border-radius
    colorstring#c7ccd1thumb color
    hoverColorstring#8f99a3thumb color on hover
    activeColorstring#666666thumb active color
  • thumbClasses (type: String, Array, Object, default: ''): custom classes for thumb

  • trackColor (type: String, default: 'transparent')