mirror of
https://github.com/wassname/slider.git
synced 2026-09-10 12:38:09 +08:00
correct e.clientX
This commit is contained in:
+7
-3
@@ -137,6 +137,10 @@ var Slider = React.createClass({
|
||||
this.setState({value: nextValue, active: 'active'}, callback);
|
||||
},
|
||||
|
||||
_getMousePosition: function(e) {
|
||||
return e.pageX || (e.clientX + document.documentElement.scrollLeft);
|
||||
},
|
||||
|
||||
_triggerEvents: function(event) {
|
||||
var props = this.props;
|
||||
var hasMarks = props.marks && props.marks.length > 0;
|
||||
@@ -184,7 +188,7 @@ var Slider = React.createClass({
|
||||
|
||||
_onMouseMove: function(e) {
|
||||
pauseEvent(e);
|
||||
var position = e.pageX || e.clientX;
|
||||
var position = this._getMousePosition(e);
|
||||
var props = this.props;
|
||||
var state = this.state;
|
||||
|
||||
@@ -222,7 +226,7 @@ var Slider = React.createClass({
|
||||
if (this.props.disabled) {
|
||||
return;
|
||||
}
|
||||
var position = e.pageX || e.clientX;
|
||||
var position = this._getMousePosition(e);
|
||||
this._start(position);
|
||||
this._addEventHandles();
|
||||
pauseEvent(e);
|
||||
@@ -233,7 +237,7 @@ var Slider = React.createClass({
|
||||
if (this.props.disabled) {
|
||||
return;
|
||||
}
|
||||
var position = e.pageX || e.clientX;
|
||||
var position = this._getMousePosition(e);
|
||||
this._calValueByPos(position,
|
||||
() => {
|
||||
this._triggerEvents('onChange');
|
||||
|
||||
Reference in New Issue
Block a user