Sha256: 2a3cb5d6648315d9f65c267b33e119fefe5cf2137c6fd5e7df8c2b0e6862c7f9

Contents?: true

Size: 591 Bytes

Versions: 4

Compression:

Stored size: 591 Bytes

Contents

/**
 * This directive adds the css position fixed if the tabs fit on screen
 */

app.directive('fixedIfFits', function($timeout) {
  return {
    restrict: 'C',
    link: function(scope, element) {
      $timeout(function() {
        var height = _(element.find('.tab-content .tab-pane').get()).map(function(el) {
          return angular.element(el).height();
        }).max() + element.offset().top;
        if (height < $(window).height()) {
          element[0].style.width = element.width() + 'px';
          element[0].style.position = 'fixed';
        }
      }, 100);
    }
  };
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
praxis-0.18.1 lib/api_browser/app/js/directives/fixed_if_fits.js
praxis-0.18.0 lib/api_browser/app/js/directives/fixed_if_fits.js
praxis-0.17.1 lib/api_browser/app/js/directives/fixed_if_fits.js
praxis-0.17.0 lib/api_browser/app/js/directives/fixed_if_fits.js