Please use ember-windoc instead
A simple service for consuming the window.onScroll
event, and using window.scrollTop
in Ember.js apps and addons. The motivation for building this, was to avoid creating very similar services across multiple addons.
Install this addon in your app
ember install ember-windowscroll
Inject the windowscroll
service onto something (i.e., a component)
import Ember from 'ember';
const { inject, Component } = Ember;
export default Component.extend({
windowscroll: inject.service()
})
Then, in your component, you can access the scrollTop
property
scrollTopInPx: computed('windowscroll.scrollTop', function() {
return `${this.get('windowscroll.scrollTop')}px`;
})
or listen to the scroll
event
didInsertElement() {
this._super(...arguments);
this.get('windowscroll').on('scroll', (e) => {
console.log('scroll happens');
});
}
This README outlines the details of collaborating on this Ember addon.
git clone
this repositorynpm install
bower install
ember server
- Visit your app at http://localhost:4200.
npm test
(Runsember try:testall
to test your addon against multiple Ember versions)ember test
ember test --server
ember build
For more information on using ember-cli, visit http://www.ember-cli.com/.