-
Notifications
You must be signed in to change notification settings - Fork 41
/
angular-vertilize.min.js
7 lines (7 loc) · 1.09 KB
/
angular-vertilize.min.js
1
2
3
4
5
6
7
/*!
* angular-vertilize 1.0.1
* Christopher Collins
* https://github.com/Sixthdim/angular-vertilize.git
* License: MIT
*/
!function(){"use strict";var a=angular.module("angular.vertilize",[]);a.directive("vertilizeContainer",[function(){return{restrict:"EA",controller:["$scope","$window",function(a,b){var c=this;c.childrenHeights=[],c.allocateMe=function(){return c.childrenHeights.push(0),c.childrenHeights.length-1},c.updateMyHeight=function(a,b){c.childrenHeights[a]=b},c.getTallestHeight=function(){for(var a=0,b=0;b<c.childrenHeights.length;b+=1)a=Math.max(a,c.childrenHeights[b]);return a},angular.element(b).bind("resize",function(){return a.$apply()})}]}}]),a.directive("vertilize",[function(){return{restrict:"EA",require:"^vertilizeContainer",link:function(a,b,c,d){var e=d.allocateMe(),f=function(){var a=b.clone().removeAttr("vertilize").css({height:"",width:b.outerWidth(),position:"fixed",top:0,left:0,visibility:"hidden"});b.after(a);var c=a.height();return a.remove(),c};a.$watch(f,function(a){a&&d.updateMyHeight(e,a)}),a.$watch(d.getTallestHeight,function(a){a&&b.css("height",a)})}}}])}();