Skip to content

mediapop/ember-viewport

Repository files navigation

@mediapop/ember-viewport

This ember addon is maintained by Media Pop, a software consultancy. Hire us to solve your web application challenges.

Build Status Ember Observer Score dependencies devDependencies

Provides a viewport service and inserts accurate faux-viewport units into CSS variable --vh. View the demo app on mobile.

/* Before */
.full-height {
  height: 100vh; /* Inaccurate on mobile */
}

/* After */
.full-height {
  height: calc(var(--vh) * 100);
}

It can also be used as a service:

export default Component.create({
  viewport: service(),
  someProperty: computed('viewport.height', function(){
    return this.viewport.height / 2;
  })
});

Installation

ember install @mediapop/ember-viewport

Compatibility

  • Ember.js v3.16 or above
  • Ember CLI v2.13 or above
  • Node.js v10 or above

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.