Skip to content

Commit

Permalink
fix: set position absolute for marks at render
Browse files Browse the repository at this point in the history
Fixes #203
  • Loading branch information
loichuder authored and stonebk committed Jan 22, 2021
1 parent 5cd9b92 commit 7d979e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/components/ReactSlider/ReactSlider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,13 @@ class ReactSlider extends React.Component {
return obj;
}

buildMarkStyle(offset) {
return {
position: 'absolute',
[this.posMinKey()]: offset,
};
}

renderThumb = (style, i) => {
const className = `${this.props.thumbClassName} ${this.props.thumbClassName}-${i} ${
this.state.index === i ? this.props.thumbActiveClassName : ''
Expand Down Expand Up @@ -1071,13 +1078,9 @@ class ReactSlider extends React.Component {
const props = {
key: mark,
className: this.props.markClassName,
style: this.buildMarkStyle(offset),
};

props.style =
this.props.orientation === 'vertical'
? { [this.props.invert ? 'bottom' : 'top']: offset }
: { [this.props.invert ? 'right' : 'left']: offset };

return this.props.renderMark(props);
});
}
Expand Down
1 change: 0 additions & 1 deletion src/styleguidist/ThemeWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const GlobalStyle = createGlobalStyle`
}
.example-mark {
position: absolute;
width: 8px;
height: 8px;
border: 2px solid #000;
Expand Down

0 comments on commit 7d979e7

Please sign in to comment.