File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change 1
- # scroll-into-view-if-needed
2
-
3
- [ ![ npm package] ( https://img.shields.io/npm/dm/scroll-into-view-if-needed.svg )] ( https://www.npmjs.com/package/scroll-into-view-if-needed )
4
-
5
- [ ![ NPM] ( https://nodei.co/npm/scroll-into-view-if-needed.png?downloadRank=true )] ( https://www.npmjs.com/package/scroll-into-view-if-needed )
6
- [ ![ NPM] ( https://nodei.co/npm-dl/scroll-into-view-if-needed.png?months=3&height=2 )] ( https://nodei.co/npm/scroll-into-view-if-needed/ )
1
+ # scroll-into-view-if-needed · ; [ ![ CircleCI Status] ( https://img.shields.io/circleci/project/github/stipsan/scroll-into-view-if-needed.svg?style=flat-square )] ( https://circleci.com/gh/stipsan/scroll-into-view-if-needed ) [ ![ npm version] ( https://img.shields.io/npm/v/scroll-into-view-if-needed.svg?style=flat-square )] ( https://www.npmjs.com/package/scroll-into-view-if-needed ) [ ![ semantic-release] ( https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square )] ( https://github.com/semantic-release/semantic-release )
7
2
8
3
This is a [ ponyfill] ( https://ponyfill.com ) with the added ability of animating the scroll itself.
9
4
@@ -12,7 +7,7 @@ Kudos to [@hsablonniere](https://github.com/hsablonniere) for sharing the [origi
12
7
## Install
13
8
14
9
``` bash
15
- npm install scroll-into-view-if-needed
10
+ yarn add scroll-into-view-if-needed
16
11
```
17
12
18
13
## API
@@ -65,15 +60,15 @@ export default class Homepage extends Component {
65
60
66
61
constructor (props ) {
67
62
super (props)
68
-
63
+
69
64
this .setSignupNode = (node ) => {
70
65
if (node) {
71
66
this ._signupNode = node
72
67
}
73
68
}
74
69
this .goToSignup = (event ) => {
75
70
event .preventDefault ()
76
-
71
+
77
72
// Passing the dom node from react is all you need for this to work
78
73
scrollIntoViewIfNeeded (this ._signupNode , false , {
79
74
duration: 150
You can’t perform that action at this time.
0 commit comments