ember-windowscroll
v0.1.1
Published
An Ember.Service for window scroll events
Downloads
16
Readme
This addon is deprecated!
Please use ember-windoc instead
ember-windowscroll
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.
Use
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.
Installation
git clone
this repositorynpm install
bower install
Running
ember server
- Visit your app at http://localhost:4200.
Running Tests
npm test
(Runsember try:testall
to test your addon against multiple Ember versions)ember test
ember test --server
Building
ember build
For more information on using ember-cli, visit http://www.ember-cli.com/.