Sha256: fa5ad43d4cbb631970857ab55121c7b7cb66eba40423c42adc58dabed0dac6fb

Contents?: true

Size: 1.28 KB

Versions: 26

Compression:

Stored size: 1.28 KB

Contents

/**
 * @ngdoc directive
 * @name Bastion.components.directive:bstContainerScroll
 * @restrict A
 *
 * @requires $window
 * @requires $timeout
 *
 * @description
 *   The container scroll directive should be applied to a wrapping div around an element that
 *   you wish to have scrolling capabilities that is outside the standard browser flow.
 *
 * @example
 *   <pre>
       <div bst-container-scroll></div>
     </pre>
 */
angular.module('Bastion.components').directive('bstContainerScroll', ['$window', '$timeout', function ($window, $timeout) {
    return {
        restrict: 'A',

        compile: function (tElement) {
            tElement.addClass("container-scroll-wrapper");
            return function (scope, element) {
                var windowElement = angular.element($window);
                var addScroll = function () {
                    var windowHeight = windowElement.height(),
                        offset = element.offset().top;

                    element.outerHeight(windowHeight - offset);
                    element.height(windowHeight - offset);
                };
                windowElement.bind('resize', addScroll);
                $timeout(function () {
                    windowElement.trigger('resize');
                }, 0);
            };
        }
    };
}]);

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
bastion-3.2.0 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-3.1.0 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-3.0.1 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-3.0.0 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-2.1.0 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-2.0.4 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-2.0.3 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-2.0.2 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-2.0.1 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-2.0.0 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-1.0.2 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-0.3.3 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-1.0.1 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-0.3.2 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-1.0.0 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-0.3.1 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-0.3.0 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-0.2.9 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-0.2.8 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js
bastion-0.2.7 app/assets/javascripts/bastion/components/bst-container-scroll.directive.js