forum-navbar.js 550 B

123456789101112131415161718192021222324
  1. import Ember from 'ember';
  2. export default Ember.Component.extend({
  3. classNames: 'navbar-spacer',
  4. affixNavbar: function() {
  5. // take navbar's height in document
  6. this.$().height(this.$().height());
  7. // affix navbar
  8. var offset = this.$('.navbar').offset().top;
  9. if (offset === 0) {
  10. // workaround around bootstrap affix mishandling elements
  11. // with resting position on top of page
  12. offset = 1;
  13. }
  14. this.$('.navbar').affix({
  15. offset: {
  16. top: offset
  17. }
  18. });
  19. }.on('didInsertElement')
  20. });