boxes-scroll
v2.1.16
Published
[](https://www.npmjs.com/package/boxes-scroll) [](https://travis-ci.org/hhdevelopment/boxes-scroll) [
Installation
Installation is easy with minimal dependencies - only the AngularJS and Jquery
Install with NPM
$ npm install boxes-scrollAdding dependency to your project
When you are done downloading all the dependencies and project files the only remaining part is to add dependencies on the scroll-box AngularJS module:
require('./node_modules/boxes-scroll/dist/boxesscroll.css');
require('./node_modules/boxes-scroll/dist/boxesscroll.js');angular.module('myModule', ['boxes.scroll']);Uses
boxes-scroll have two directives
- box-vscroll : it is the most common use. it is a box with vertical scrollbar, synchronized with ng-repeat:
for example, on tr in the table with many rows. - box-hscroll : A box with horizontal scrollbar, synchronized with ng-repeat.
HTML
Example with bootstrap table
<box-vscroll total="ctrl.items.length" ng-begin="begin" ng-limit="limit"
style="border:solid 1px black;height:300px">
<table class="table table-hover table-striped">
<thead>
<tr>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in ctrl.items| limitTo:limit:begin">
<td ng-bind="item"></td>
</tr>
</tbody>
</table>
</box-vscroll>(function (ng) {
'use strict';
ng.module('app', ['boxes.scroll']).controller('AppCtrl', AppCtrl);
function AppCtrl() {
var ctrl = this;
ctrl.items = [.......];
}
})(angular);Configuration
Important : For vertical box-vscroll container, you have to set the height css property. Instead, you can set max-height.
If you use max-height, you will see the item drawed one by one. Prefer height, mostly if many items will be visible.
If you don't set height or max-height you have to set the max attribute.
Attributes configuration
- total (number) : The number of items
- ng-limit : the limit of window for directive limitTo. This value is managed by the directive, don't set it, just name it, in controller or scope
- ng-begin : the begin of window for directive limitTo. This value is managed by the directive, don't set it, just name it, in controller or scope
- show-info-delay (number) (optional) : define the delay of time the infos about the window appears. Default value 1000 ms
- debounce (number) (optional) : Set the delay before compute ng-limit. Default value 100 ms
- max (number) (optional) : Define the maximun of number items rendered
Soon features
Choose position of scrollbars,
- box-vscroll : left, right(default), both
- box-hscroll : top, bottom(default), both
