react-custom-scrollbars
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -216,2 +216,48 @@ 'use strict'; | ||
scrollTop: function scrollTop() { | ||
var top = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; | ||
var $view = this.refs.view; | ||
$view.scrollTop = top; | ||
this.needsUpdate = true; | ||
this.update(); | ||
}, | ||
scrollToTop: function scrollToTop() { | ||
var $view = this.refs.view; | ||
$view.scrollTop = 0; | ||
this.needsUpdate = true; | ||
this.update(); | ||
}, | ||
scrollToBottom: function scrollToBottom() { | ||
var $view = this.refs.view; | ||
$view.scrollTop = $view.scrollHeight; | ||
this.needsUpdate = true; | ||
this.update(); | ||
}, | ||
scrollLeft: function scrollLeft() { | ||
var left = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; | ||
var $view = this.refs.view; | ||
$view.scrollLeft = left; | ||
this.needsUpdate = true; | ||
this.update(); | ||
}, | ||
scrollToLeft: function scrollToLeft() { | ||
var $view = this.refs.view; | ||
$view.scrollLeft = 0; | ||
this.needsUpdate = true; | ||
this.update(); | ||
}, | ||
scrollToRight: function scrollToRight() { | ||
var $view = this.refs.view; | ||
$view.scrollLeft = $view.scrollWidth; | ||
this.needsUpdate = true; | ||
this.update(); | ||
}, | ||
update: function update() { | ||
@@ -218,0 +264,0 @@ if (SCROLLBAR_WIDTH === 0) return; |
{ | ||
"name": "react-custom-scrollbars", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "React scrollbars component", | ||
@@ -45,4 +45,4 @@ "main": "lib/index.js", | ||
"mocha": "^2.2.5", | ||
"react": "^0.14.0-rc1", | ||
"react-dom": "^0.14.0-rc1", | ||
"react": "^0.14.3", | ||
"react-dom": "^0.14.3", | ||
"rimraf": "^2.3.4", | ||
@@ -53,6 +53,6 @@ "webpack": "^1.9.6", | ||
"peerDependencies": { | ||
"react": "^0.14.0-rc1", | ||
"react-dom": "^0.14.0-rc1" | ||
"react": "^0.14.3", | ||
"react-dom": "^0.14.3" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -138,2 +138,35 @@ react-custom-scrollbars | ||
#### Methods | ||
* `scrollTop(top)`: Scroll to the top value | ||
* `scrollLeft(left)`: Scroll to the left value | ||
* `scrollToTop()`: Scroll to top | ||
* `scrollToBottom()`: Scroll to bottom | ||
* `scrollToLeft()`: Scroll to left | ||
* `scrollToRight()`: Scroll to right | ||
```javascript | ||
import { Scrollbars } from 'react-custom-scrollbars'; | ||
class App extends Component { | ||
handleClick() { | ||
this.refs.scrollbars.scrollToTop() | ||
}, | ||
render() { | ||
return ( | ||
<div> | ||
<Scrollbars | ||
ref="scrollbars" | ||
style={{ width: 500, height: 300 }}> | ||
{/* your content */} | ||
</Scrollbars> | ||
<button onClick={this.handleClick.bind(this)}> | ||
Scroll to top | ||
</button> | ||
</div> | ||
); | ||
} | ||
} | ||
``` | ||
### Receive values about the current position | ||
@@ -140,0 +173,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30732
465
212