JSPM

  • Created
  • Published
  • Downloads 207
  • Score
    100M100P100Q56617F
  • License MIT

An angular module that allows you customize smooth scrollbars

Package Exports

  • angular-smooth-scrollbar

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (angular-smooth-scrollbar) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

angular-smooth-scrollbar

npm npm npm Travis

smooth-scrollbar for angular projects.

Requirements

Angular 1.4+

Install

Via npm:

npm install angular-smooth-scrollbar --save

Or via bower:

bower install angular-smooth-scrollbar --save

Demo

http://idiotwu.github.io/angular-smooth-scrollbar/

Usage

  1. Include all dependencies in your page file:

    <link rel="stylesheet" href="smooth-scrollbar/dist/smooth-scrollbar.css">
    
    <script src="angular.js"></script>
    <script src="smooth-scrollbar/dist/smooth-scrollbar.js"></script>
    <script src="angular-smooth-scrollbar/dist/angular-smooth-scrollbar.js"></script>
  2. Add SmoothScrollbar as dependency to your angular app:

    angular.module('myApp', ['SmoothScrollbar']);
  3. Use it wherever you want:

    • As element:

      <scrollbar name="scrollbar_name">
          ...
      </scrollbar>
    • As attribute:

      <section scrollbar="scrollbar_name">
          ...
      </section>

Available Options

parameter type default description
name String@ N/A Naming current scrollbar.
speed Number= 1 Scrolling speed scale.
friction Number= 10 Scrolling friction, a percentage value within (1, 100).
thumbMinSize Number= 20 Minimal size for scrollbar thumb.
renderByPixels Boolean= true Render scrolling by integer pixels, set to true to improve performance.
continuousScrolling Boolean=|String= 'auto' Whether allow upper scrollable content to continue scrolling when current scrollbar reaches edge. When set to 'auto', it will be enabled on nested scrollbars, and disabled on first-class scrollbars.

Confusing with the option field? Try edit tool here!

ScrollbarServiceProvider

You can configure default scrollbar behavior here:

angular.module('myApp', ['SmoothScrollbar'])
.config((ScrollbarServiceProvider) => {
    // set default scrollbar behavior
});

ScrollbarServiceProvider.setDefaultOptions( options )

Set default scrollbar options for your angular app.

ScrollbarService

By given scrollbar a name via attribute, you can access your scrollbar instances through ScrollbarService.

ScrollbarService.generateName()

Return a timestamp string, this will be useful while trying naming scrollbars uniquely.

ScrollbarService.getInstance( name )

Get scrollbar instance by giving the name, and return a promise with instance.

ScrollbarService.destroyInstance( name )

Remove all event listeners on the named instance, but will not remove scrollbar from DOM.

APIs

Documents

License

MIT.