Skip to content

Commit

Permalink
optimize sticky engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Sönke Kluth committed Sep 16, 2016
1 parent 9ae1ccf commit 89da9bb
Show file tree
Hide file tree
Showing 13 changed files with 1,367 additions and 1,490 deletions.
6 changes: 4 additions & 2 deletions .babelrc
Expand Up @@ -5,6 +5,8 @@
"es2015"
],
"plugins": [
"transform-class-properties"
]
"transform-class-properties",
"transform-class-constructor-call",
"add-module-exports"
]
}
30 changes: 26 additions & 4 deletions README.md
Expand Up @@ -24,17 +24,31 @@ your css should contain the following lines:
(you can specify the classNames in js)
```css
.sticky {
position: -webkit-sticky;
position: sticky;
}

.sticky.sticky-fixed.is-sticky {
margin-top: 0;
margin-bottom: 0;
position: fixed;
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
backface-visibility: hidden;
}

.sticky.sticky-fixed.is-absolute {
.sticky.sticky-fixed.is-sticky:not([style*="margin-top"]) {
margin-top: 0 !important;
}
.sticky.sticky-fixed.is-sticky:not([style*="margin-bottom"]) {
margin-bottom: 0 !important;
}


.sticky.sticky-fixed.is-absolute{
position: absolute;
}

```

### js
Expand Down Expand Up @@ -63,7 +77,8 @@ static propTypes = {
absoluteClass: React.PropTypes.string,
disabled: React.PropTypes.bool,
debug: React.PropTypes.bool,
tagName: React.PropTypes.string
tagName: React.PropTypes.string,
scrollClass: PropTypes.object
};

static defaultProps = {
Expand All @@ -75,6 +90,13 @@ static propTypes = {
absoluteClass: 'is-absolute',
debug: false,
disabled: false,
tagName: 'div'
tagName: 'div',
scrollClass: {
down: null,
up: null,
none: null,
persist: false,
active: false
}
};
```

0 comments on commit 89da9bb

Please sign in to comment.