File tree Expand file tree Collapse file tree 5 files changed +71
-6
lines changed Expand file tree Collapse file tree 5 files changed +71
-6
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ <h1><a href="http://threejs.org">three.js</a></h1>
27
27
28
28
< div id ="contentWrapper ">
29
29
< input placeholder ="Search " type ="text " id ="filter " autocorrect ="off " autocapitalize ="off " spellcheck ="false " />
30
+ < div id ="exitSearchButton "> </ div >
30
31
31
32
< select id ="language ">
32
33
< option value ="en "> en</ option >
@@ -91,6 +92,7 @@ <h1><a href="http://threejs.org">three.js</a></h1>
91
92
var panel = document . getElementById ( 'panel' ) ;
92
93
var content = document . getElementById ( 'content' ) ;
93
94
var expandButton = document . getElementById ( 'expandButton' ) ;
95
+ var exitSearchButton = document . getElementById ( 'exitSearchButton' ) ;
94
96
var panelScrim = document . getElementById ( 'panelScrim' ) ;
95
97
var filterInput = document . getElementById ( 'filter' ) ;
96
98
var iframe = document . querySelector ( 'iframe' ) ;
@@ -120,6 +122,19 @@ <h1><a href="http://threejs.org">three.js</a></h1>
120
122
121
123
122
124
// Functionality for search/filter input field
125
+ filterInput . onfocus = function ( event ) {
126
+
127
+ panel . classList . add ( 'searchFocused' ) ;
128
+
129
+ }
130
+
131
+ exitSearchButton . onclick = function ( event ) {
132
+
133
+ filterInput . value = '' ;
134
+ updateFilter ( ) ;
135
+ panel . classList . remove ( 'searchFocused' ) ;
136
+
137
+ }
123
138
124
139
filterInput . oninput = function ( event ) {
125
140
Original file line number Diff line number Diff line change @@ -161,8 +161,8 @@ strong {
161
161
162
162
# button {
163
163
position : fixed;
164
- bottom : 16 px ;
165
- right : 16 px ;
164
+ bottom : 12 px ;
165
+ right : 12 px ;
166
166
167
167
padding : 8px ;
168
168
border-radius : 50% ;
@@ -179,6 +179,7 @@ strong {
179
179
180
180
# button img {
181
181
display : block;
182
+ width : 20px ;
182
183
}
183
184
184
185
a .permalink {
Original file line number Diff line number Diff line change 12
12
}
13
13
# button {
14
14
position : fixed;
15
- bottom : 16 px ;
16
- right : 16 px ;
15
+ bottom : 12 px ;
16
+ right : 12 px ;
17
17
18
18
padding : 8px ;
19
19
border-radius : 50% ;
30
30
31
31
# button img {
32
32
display : block;
33
+ width : 20px ;
33
34
}
34
35
</ style >
35
36
</ head >
@@ -52,6 +53,7 @@ <h1><a href="http://threejs.org">three.js</a></h1>
52
53
53
54
< div id ="contentWrapper ">
54
55
< input placeholder ="Search " type ="text " id ="filter " autocorrect ="off " autocapitalize ="off " spellcheck ="false " />
56
+ < div id ="exitSearchButton "> </ div >
55
57
56
58
< select id ="language ">
57
59
< option value ="en "> en</ option >
@@ -84,6 +86,7 @@ <h1><a href="http://threejs.org">three.js</a></h1>
84
86
var viewer = document . getElementById ( 'viewer' ) ;
85
87
86
88
var filterInput = document . getElementById ( 'filter' ) ;
89
+ var exitSearchButton = document . getElementById ( 'exitSearchButton' ) ;
87
90
88
91
var expandButton = document . getElementById ( 'expandButton' ) ;
89
92
expandButton . addEventListener ( 'click' , function ( event ) {
@@ -193,6 +196,19 @@ <h1><a href="http://threejs.org">three.js</a></h1>
193
196
}
194
197
195
198
// filter
199
+ filterInput . onfocus = function ( event ) {
200
+
201
+ panel . classList . add ( 'searchFocused' ) ;
202
+
203
+ }
204
+
205
+ exitSearchButton . onclick = function ( event ) {
206
+
207
+ filterInput . value = '' ;
208
+ updateFilter ( ) ;
209
+ panel . classList . remove ( 'searchFocused' ) ;
210
+
211
+ }
196
212
197
213
filterInput . addEventListener ( 'input' , function ( e ) {
198
214
Original file line number Diff line number Diff line change 3
3
--text-color : # 444 ;
4
4
--border-style : 1px solid # EEE ;
5
5
--header-height : 48px ;
6
+ --panel-padding : 16px ;
6
7
}
7
8
8
9
@font-face {
@@ -83,6 +84,34 @@ h1 a {
83
84
transition : 0s 0s height;
84
85
}
85
86
87
+ # panel # exitSearchButton {
88
+ position : absolute;
89
+ width : 40px ;
90
+ height : 40px ;
91
+ top : 4px ;
92
+ right : calc (var (--panel-padding ) - 12px );
93
+ z-index : 1000 ;
94
+ display : none;
95
+ background-size : 20px 20px ;
96
+ background-position : 50% 50% ;
97
+ background-repeat : no-repeat;
98
+ background-image : url(../ files/ic_close_black_24dp.svg);
99
+ cursor : pointer;
100
+ }
101
+
102
+ # panel .searchFocused # exitSearchButton {
103
+ display : block;
104
+ }
105
+
106
+ # panel .searchFocused # language {
107
+ display : none;
108
+ }
109
+
110
+ # panel .searchFocused # filter {
111
+ background-image : none;
112
+ padding-left : var (--panel-padding );
113
+ }
114
+
86
115
# panel # expandButton {
87
116
margin-right : 14px ;
88
117
margin-left : 4px ;
@@ -100,7 +129,7 @@ h1 a {
100
129
}
101
130
102
131
# panel # sections * {
103
- padding : 0 16 px ;
132
+ padding : 0 var ( --panel-padding ) ;
104
133
height : 100% ;
105
134
position : relative;
106
135
display : flex;
@@ -166,7 +195,7 @@ h1 a {
166
195
# panel # content {
167
196
flex : 1 ;
168
197
overflow : scroll;
169
- padding : 0 16 px 24px 16 px ;
198
+ padding : 0 var ( --panel-padding ) 24px var ( --panel-padding ) ;
170
199
}
171
200
172
201
# panel # content ul {
You can’t perform that action at this time.
0 commit comments