Skip to content

Commit 1331cc7

Browse files
author
GuyR
committed
block content selection while draggin the scroll handle - fixes rommguy#5
1 parent bacafac commit 1331cc7

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

example/styles.css

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ figure {
169169
* Address differences between Firefox and other browsers.
170170
*/
171171
hr {
172-
-moz-box-sizing: content-box;
173172
box-sizing: content-box;
174173
height: 0; }
175174

@@ -298,8 +297,6 @@ input[type="number"]::-webkit-outer-spin-button {
298297
input[type="search"] {
299298
-webkit-appearance: textfield;
300299
/* 1 */
301-
-moz-box-sizing: content-box;
302-
-webkit-box-sizing: content-box;
303300
/* 2 */
304301
box-sizing: content-box; }
305302

@@ -361,7 +358,8 @@ th {
361358
position: relative; }
362359
.custom-scroll .outer-container:hover .custom-scrollbar {
363360
opacity: 1;
364-
transition-duration: 0.2s; }
361+
-webkit-transition-duration: 0.2s;
362+
transition-duration: 0.2s; }
365363

366364
.custom-scroll .inner-container {
367365
overflow-x: hidden;
@@ -373,21 +371,31 @@ th {
373371
right: 0;
374372
left: 0;
375373
height: 0;
374+
background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.05) 60%, transparent 100%);
376375
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.05) 60%, transparent 100%);
377376
pointer-events: none;
377+
-webkit-transition: height 0.1s ease-in;
378378
transition: height 0.1s ease-in;
379379
will-change: height; }
380380
.custom-scroll .inner-container.content-scrolled:after {
381381
height: 5px;
382+
-webkit-transition: height 0.15s ease-out;
382383
transition: height 0.15s ease-out; }
383384

385+
.custom-scroll.scroll-handle-dragged .inner-container {
386+
-webkit-user-select: none;
387+
-moz-user-select: none;
388+
-ms-user-select: none;
389+
user-select: none; }
390+
384391
.custom-scroll .custom-scrollbar {
385392
position: absolute;
386393
height: 100%;
387394
width: 6px;
388395
right: 3px;
389396
opacity: 0;
390397
z-index: 1;
398+
-webkit-transition: opacity 0.4s ease-out;
391399
transition: opacity 0.4s ease-out;
392400
padding: 6px 0;
393401
box-sizing: border-box;
@@ -425,6 +433,7 @@ body {
425433
font-size: 18px; }
426434

427435
.scroll-creator {
436+
background: -webkit-linear-gradient(top, #BDEAFC, #FCBDC9);
428437
background: linear-gradient(to bottom, #BDEAFC, #FCBDC9); }
429438

430439
.panel {

src/main/cs.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
}
3434
}
3535

36+
&.scroll-handle-dragged .inner-container {
37+
user-select: none;
38+
}
39+
3640
.custom-scrollbar {
3741
position: absolute;
3842
height: 100%;

src/main/customScroll.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
position: relative; }
44
.custom-scroll .outer-container:hover .custom-scrollbar {
55
opacity: 1;
6-
transition-duration: 0.2s; }
6+
-webkit-transition-duration: 0.2s;
7+
transition-duration: 0.2s; }
78

89
.custom-scroll .inner-container {
910
overflow-x: hidden;
@@ -15,21 +16,31 @@
1516
right: 0;
1617
left: 0;
1718
height: 0;
19+
background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.05) 60%, transparent 100%);
1820
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.05) 60%, transparent 100%);
1921
pointer-events: none;
22+
-webkit-transition: height 0.1s ease-in;
2023
transition: height 0.1s ease-in;
2124
will-change: height; }
2225
.custom-scroll .inner-container.content-scrolled:after {
2326
height: 5px;
27+
-webkit-transition: height 0.15s ease-out;
2428
transition: height 0.15s ease-out; }
2529

30+
.custom-scroll.scroll-handle-dragged .inner-container {
31+
-webkit-user-select: none;
32+
-moz-user-select: none;
33+
-ms-user-select: none;
34+
user-select: none; }
35+
2636
.custom-scroll .custom-scrollbar {
2737
position: absolute;
2838
height: 100%;
2939
width: 6px;
3040
right: 3px;
3141
opacity: 0;
3242
z-index: 1;
43+
-webkit-transition: opacity 0.4s ease-out;
3344
transition: opacity 0.4s ease-out;
3445
padding: 6px 0;
3546
box-sizing: border-box;

0 commit comments

Comments
 (0)