GithubHelp home page GithubHelp logo

angular-baron-scrollbar's Introduction

angular-baron-scrollbar

A wrapper around baron scrollbar library.

Usage

  1. npm install angular-baron-scrollbar
  2. In app code:
angular.module('app', [ require('angular-baron-scrollbar') ])

or replace require() by 'angular-baron-scrollbar' and put appropriate <script src='.../dist/index.js'> tag in your html. 3. Use <baron-scrollbar> directive in your templates:

<style type="text/css">
	.scroll-wrapper {
		position: relative;
		overflow: hidden;
		height: 300px;
	}
</style>

<baron-scrollbar class="scroll-wrapper" opts="..." hopts="..." direction="x | y | xy" update="update">
	... SCROLLABLE CONTENT HERE ...
</baron-scrollbar>

The opts/hopts attributes allow to configure vertical/horizontal scrollbar instances (see baron for configuration options). For example:

// in controller:
$scope.scrollopts = {
	pause: 0.2
};

<!-- in template -->
<baron-scrollbar opts="scrollopts">
	...
</baron-scrollbar>

Or you may pass an object directly within template:

<baron-scrollbar opts="{pause: 0.2}">
	...
</baron-scrollbar>

The update attribute may point to a variable from $scope. Setting this variable to true forces scrollbar update. The variable is set to false automatically afterwards.

Example

A working example can be found in the example directory. Just open index.html in browser.

Notes

  • This is a UMD module, so it can be used in a script tag and as a CommonJS/RequireJS module.
  • The CSS is prepended to <head> automatically (so that you can override it if you want; see example/index.html for example).
  • The in-view-container attribute is added to the scroller div so that angular-inview directive works. I did not find a way to make this attribute optional, so feel free to let me know if you know how to do this. This should be harmless if you do not use angular-inview.

License

MIT

angular-baron-scrollbar's People

Contributors

svbatalov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.