Skip to content

Commit

Permalink
Update README.md (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Limmer authored and snewcomer committed Oct 1, 2018
1 parent 9f0f51b commit 503cd97
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ These hooks fire once whenever the `Component` enters or exits the viewport. You

```js
import Component from '@ember/component';
import InViewportMixin from 'ember-in-viewport';

export default Component.extend(InViewportMixin, {
didEnterViewport() {
Expand All @@ -59,6 +60,7 @@ The `didScroll` hook fires when an element enters the viewport. For example, if

```js
import Component from '@ember/component';
import InViewportMixin from 'ember-in-viewport';

export default Component.extend(InViewportMixin, {
didScroll(direction) {
Expand All @@ -71,7 +73,10 @@ export default Component.extend(InViewportMixin, {
To apply an `.active` class to your `Component` when it enters the viewport, you can simply bind the `active` class to the mixed in property `viewportEntered`, like so:

```js
export default Ember.Component.extend(InViewportMixin, {
import Component from '@ember/component';
import InViewportMixin from 'ember-in-viewport';

export default Component.extend(InViewportMixin, {
classNameBindings: [ 'viewportEntered:active' ]
});
```
Expand All @@ -84,12 +89,14 @@ The mixin comes with some options. Due to the way listeners and `IntersectionObs

```js
import Component from '@ember/component';
import InViewportMixin from 'ember-in-viewport';
import { setProperties } from '@ember/object';

export default Component.extend(InViewportMixin, {
init() {
this._super(...arguments);

Ember.setProperties(this, {
setProperties(this, {
viewportEnabled : true,
viewportUseRAF : true,
viewportSpy : false,
Expand Down

0 comments on commit 503cd97

Please sign in to comment.