Skip to content

Commit 9f29830

Browse files
committed
[issue-6]: Add IE9, IE10 support
1 parent 6109561 commit 9f29830

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/ReactHover.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export default class ReactHover extends Component {
1414
constructor (props) {
1515
super(props)
1616
this.state = {
17-
triggerComponentStyle: this.props.styles.trigger,
18-
hoverComponentStyle: this.props.styles.hoverComponent
17+
triggerComponentStyle: props.styles.trigger,
18+
hoverComponentStyle: props.styles.hoverComponent
1919
}
2020
}
2121

@@ -42,9 +42,9 @@ export default class ReactHover extends Component {
4242
let { hoverComponentStyle } = this.state
4343
let updatedStyles = null
4444
if (flag) {
45-
updatedStyles = Object.assign({}, hoverComponentStyle, {display: 'block'})
45+
updatedStyles = {...hoverComponentStyle, display: 'block'}
4646
} else {
47-
updatedStyles = Object.assign({}, hoverComponentStyle, {display: 'none'})
47+
updatedStyles = {...hoverComponentStyle, display: 'none'}
4848
}
4949
this.setState({
5050
hoverComponentStyle: updatedStyles
@@ -55,18 +55,18 @@ export default class ReactHover extends Component {
5555
const cursorX = e.pageX
5656
const cursorY = e.pageY
5757
let {options: { followCursor, shiftX, shiftY }} = this.props
58-
const { hoverComponentStyle } = this.state
58+
let { hoverComponentStyle } = this.state
5959
let updatedStyles = null
6060
if (!followCursor) {
6161
return
6262
}
63-
if (shiftX == NaN) {
63+
if (isNaN(shiftX)) {
6464
shiftX = 0
6565
}
66-
if (shiftY == NaN) {
66+
if (isNaN(shiftY)) {
6767
shiftY = 0
6868
}
69-
updatedStyles = Object.assign({}, hoverComponentStyle, {top: cursorY + shiftY, left: cursorX + shiftX})
69+
updatedStyles = {...hoverComponentStyle, top: cursorY + shiftY, left: cursorX + shiftX}
7070
this.setState({
7171
hoverComponentStyle: updatedStyles
7272
})

0 commit comments

Comments
 (0)