https://github.com/pocesar/angular-track-height
Watch an element for the min or/and max height then save it for use somewhere else
https://github.com/pocesar/angular-track-height
Last synced: 5 months ago
JSON representation
Watch an element for the min or/and max height then save it for use somewhere else
- Host: GitHub
- URL: https://github.com/pocesar/angular-track-height
- Owner: pocesar
- License: mit
- Created: 2015-08-19T19:49:01.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-08-20T00:46:34.000Z (almost 11 years ago)
- Last Synced: 2025-06-03T11:30:42.389Z (about 1 year ago)
- Language: HTML
- Homepage:
- Size: 137 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Angular Track Height
Watch an element for the min or/and max height then save it for use somewhere else
Mostly to avoid flicker on ui-view/ng-view when it changes height.
## Install
### Bower
```bash
$ bower install angular-track-height --save
```
### NPM
```bash
$ npm install angular-track-height --save
```
Requires requestAnimationFrame
## Usage
### Directives
#### track-height
Tracks the height of an element for usage somewhere else, like inside a controller or inside other directives.
```html
```
#### track-height-apply
You can set the min and max, depending on the options you pass to it.
By passing "min", the `min-height` will be set to the mininum value the element ever had (can be 0)
By passing "max", the `min-height` will be set to the max value the element ever had
By passing "min max", the `height` will be set to the max value the element ever had (might have problems with heavily responsive elements)
```html
```
### Service
#### TrackHeight
You can access your element height using this service, by the name you provide
##### `.get`
Gets the min or max height of an element
##### `.set`
Programatically sets the min or max height of an element
```js
angular
.module('App', [
'TrackHeight'
])
.controller('yourcontroller', ['TrackHeight', function(TrackHeight){
var heights = TrackHeight.get('nameit');
// heights.min / heights.max / heights.current;
TrackHeight.set('nameit', {
min: 10,
max: 100,
current: 50
});
});
```
## License
MIT