Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request fisshy#78 from GabrielCTroia/improveScrollToElm
Browse files Browse the repository at this point in the history
scroller.scrollTo() can take no props now. Improve readme
  • Loading branch information
fisshy committed Apr 26, 2016
2 parents 59439fb + b8e03c2 commit f619f9c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ scroll.scrollToBottom(options);

```

> Scroll To (px)
> Scroll To (position)
```js

Expand All @@ -171,6 +171,27 @@ scroll.scrollTo(100, options);

```

> Scroll To (Element)
animateScroll.scrollTo(positionInPixels, props = {});

```js

var Scroll = require('react-scroll');
var Element = Scroll.Element;
var scroller = Scroll.scroller;

<Element name="myScrollToElement"></Element>

// Somewhere else, even another file
scroller.scrollTo('myScrollToElement', {
duration: 1500,
delay: 100,
smooth: true,
})

```

> Scroll More (px)
```js
Expand Down
2 changes: 2 additions & 0 deletions modules/mixins/scroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ module.exports = {
throw new Error("target Element not found");
}

props = props || {};

var coordinates = target.getBoundingClientRect();

if(events.registered['begin']) {
Expand Down

0 comments on commit f619f9c

Please sign in to comment.