Skip to content

Commit 522c61e

Browse files
committed
Fixed thumb's jumps on scroll start, for cases when wrapper has position: relative; and scrollbars has been hidden;
1 parent ff739ca commit 522c61e

File tree

7 files changed

+230
-149
lines changed

7 files changed

+230
-149
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ npm run examples
5151

5252
## Credits
5353
Big thanks to [@malte-wessel](https://github.com/malte-wessel) with his [react-custom-scrollbars](https://github.com/malte-wessel/react-custom-scrollbars) which I used before writing this component.
54-
So don't be wondered that repos and code look similar in some places, his package used as ethalon. And for the users convenience i've tried to make API's seamless as much as it possible.
54+
So don't be wondered that repos and code look similar in some places, his package used as ethalon. And for the users convenience i've tried to make API's seamless as much as it possible.

src/Scrollbar/defaultElementRender.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ export function thumbVertical(props) {
2222

2323
export function thumbHorizontal(props) {
2424
return <div className="CustomScrollbar-thumb CustomScrollbar-thumbHorizontal" { ...props } />;
25-
}
25+
}

src/Scrollbar/defaultElementStyle.js

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,65 @@ export const holder = {
44
gridTemplateColumns: '1fr min-content',
55
gridTemplateRows: '1fr min-content',
66
};
7-
87
export const wrapper = {
98
gridColumn: 1,
109
gridRow: 1,
1110
};
12-
1311
export const trackVertical = {
1412
position: 'relative',
1513
width: 8,
1614
background: 'rgba(0,0,0,.1)',
1715
gridColumn: 2,
1816
gridRow: 1,
1917
};
20-
2118
export const trackHorizontal = {
2219
position: 'relative',
2320
height: 8,
2421
background: 'rgba(0,0,0,.1)',
2522
gridColumn: 1,
2623
gridRow: 2,
2724
};
28-
2925
export const thumbVertical = {
3026
position: 'relative',
3127
width: '100%',
3228
height: 0,
3329
cursor: 'pointer',
3430
background: 'rgba(0,0,0,.35)',
3531
};
36-
3732
export const thumbHorizontal = {
3833
position: 'relative',
3934
height: '100%',
4035
width: 0,
4136
cursor: 'pointer',
4237
background: 'rgba(0,0,0,.35)',
4338
};
44-
4539
export const content = {
4640
position: 'absolute',
4741
top: 0,
4842
bottom: 0,
4943
left: 0,
5044
right: 0,
5145
overflow: 'scroll',
52-
};
46+
};
47+
48+
export const holderGridless = {
49+
display: 'block',
50+
position: 'relative',
51+
};
52+
export const wrapperGridless = {};
53+
export const trackVerticalGridless = {
54+
background: 'rgba(0,0,0,.1)',
55+
position: 'absolute',
56+
width: 8,
57+
height: '100%',
58+
right: 0,
59+
top: 0,
60+
};
61+
export const trackHorizontalGridless = {
62+
background: 'rgba(0,0,0,.1)',
63+
position: 'absolute',
64+
height: 8,
65+
width: '100%',
66+
left: 0,
67+
bottom: 0,
68+
};

0 commit comments

Comments
 (0)