diff options
author | afc163 <afc163@gmail.com> | 2015-11-29 15:14:32 +0800 |
---|---|---|
committer | afc163 <afc163@gmail.com> | 2015-11-29 15:14:32 +0800 |
commit | 85d09ad3310c26d61b6af60b28d680eed1f2bf1c (patch) | |
tree | a346113772f90bfb6288b114309cd78432dd8b06 | |
parent | ec9325586535a0067af78586873349f53dcfdd4c (diff) | |
download | time-picker-85d09ad3310c26d61b6af60b28d680eed1f2bf1c.tar.gz time-picker-85d09ad3310c26d61b6af60b28d680eed1f2bf1c.tar.zst time-picker-85d09ad3310c26d61b6af60b28d680eed1f2bf1c.zip |
show scrollbar when hover
-rw-r--r-- | assets/index/Select.less | 10 | ||||
-rw-r--r-- | src/module/Select.jsx | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/assets/index/Select.less b/assets/index/Select.less index 4efeac9..bca25f9 100644 --- a/assets/index/Select.less +++ b/assets/index/Select.less | |||
@@ -8,6 +8,10 @@ | |||
8 | width: 56px; | 8 | width: 56px; |
9 | overflow: hidden; | 9 | overflow: hidden; |
10 | 10 | ||
11 | &:hover { | ||
12 | overflow-y: auto; | ||
13 | } | ||
14 | |||
11 | &:first-child { | 15 | &:first-child { |
12 | border-left: 0; | 16 | border-left: 0; |
13 | margin-left: 0; | 17 | margin-left: 0; |
@@ -19,18 +23,16 @@ | |||
19 | 23 | ||
20 | ul { | 24 | ul { |
21 | list-style: none; | 25 | list-style: none; |
22 | box-sizing: content-box; | 26 | box-sizing: border-box; |
23 | margin: 0; | 27 | margin: 0; |
24 | padding: 0; | 28 | padding: 0; |
25 | width: 100%; | 29 | width: 100%; |
26 | max-height: 144px; | 30 | max-height: 144px; |
27 | overflow: auto; | ||
28 | padding-right: 16px; | ||
29 | } | 31 | } |
30 | 32 | ||
31 | li { | 33 | li { |
32 | list-style: none; | 34 | list-style: none; |
33 | box-sizing: content-box; | 35 | box-sizing: border-box; |
34 | margin: 0; | 36 | margin: 0; |
35 | padding: 0 0 0 16px; | 37 | padding: 0 0 0 16px; |
36 | width: 100%; | 38 | width: 100%; |
diff --git a/src/module/Select.jsx b/src/module/Select.jsx index 119e59e..b386d07 100644 --- a/src/module/Select.jsx +++ b/src/module/Select.jsx | |||
@@ -64,7 +64,7 @@ const Select = React.createClass({ | |||
64 | } | 64 | } |
65 | const topOption = list.children[index]; | 65 | const topOption = list.children[index]; |
66 | const to = topOption.offsetTop - select.offsetTop; | 66 | const to = topOption.offsetTop - select.offsetTop; |
67 | scrollTo(list, to, duration); | 67 | scrollTo(select, to, duration); |
68 | }, | 68 | }, |
69 | 69 | ||
70 | render() { | 70 | render() { |