tab-sdk-mrdx

0.0.8 • Public • Published

tab-sdk-mrdx

A custom scrollbar written in pure AngularJS.

Works with the mouse and on touch screen.

Tired of using jquery for a stupid scrollbar? well, this directive is just for you.

Usage

  1. Add tab-sdk-mrdx.min.js to you main file (index.html)

you can download this by:

In your web page:

<script src="angular.js"></script>
<script src="dist/tab-sdk-mrdx.min.js"></script>
<link rel="stylesheet" href="dist/tab-sdk-mrdx.min.css" />
  1. Set ngScrollbar as a dependency in your module
var myapp = angular.module("myapp", ["ngScrollbar"]);
  1. Add tab-sdk-mrdx directive to the wanted element, example:
<div class="scrollme" tab-sdk-mrdx>....</div>

Rebuild the scrollbar

In case you need to rebuild the scrollbar, you may tell tab-sdk-mrdx to rebuild it for you by broadcasting an event. It's useful to use this option when the size or visibility of the container is dynamic and during the link phase the size can't be determined.

<div class="scrollme" tab-sdk-mrdx rebuild-on="rebuild:me">....</div>
// rebuild the scrollbar
$scope.$broadcast("rebuild:me");

In case you need to rebuild the scrollbar on every window's resize, you may use "rebuild-on-resize" option.

<div class="scrollme" tab-sdk-mrdx rebuild-on-resize>....</div>

In case you need to stick content to bottom (chat or something) use "bottom" option.

<div class="scrollme" tab-sdk-mrdx bottom>....</div>

Events and Flags

On rebuilding the scrollbar you can get notified by 2 events

$scope.$on("scrollbar.show", function () {
  console.log("Scrollbar show");
});
$scope.$on("scrollbar.hide", function () {
  console.log("Scrollbar hide");
});

Or you can use "is-bar-shown" option. It should be read-only

<div class="scrollme" tab-sdk-mrdx is-bar-shown="flag">....</div>
<div>Bar shown: {{flag}}</div>

Examples

See the example in the respository. example/index.html

Bitdeli Badge

Package Sidebar

Install

npm i tab-sdk-mrdx

Weekly Downloads

1

Version

0.0.8

License

none

Unpacked Size

45.5 kB

Total Files

18

Last publish

Collaborators

  • mxdc