File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 13
13
</ head >
14
14
< body >
15
15
< div class ="search ">
16
- < input type ="text " class ="input " placeholder ="Search... " />
17
- < button class ="btn "> < i class ="fas fa-search "> </ i > </ button >
16
+ <!-- Change Placeholder Text -->
17
+ < input type ="text " class ="input " placeholder ="Type and hit enter... " />
18
+ <!-- Change the Search Icon -->
19
+ < button class ="btn "> < i class ="fas fa-search-plus "> </ i > </ button >
18
20
</ div >
19
21
< script src ="script.js "> </ script >
20
22
</ body >
Original file line number Diff line number Diff line change 1
1
const search = document . querySelector ( ".search" ) ;
2
2
const btn = document . querySelector ( ".btn" ) ;
3
3
const input = document . querySelector ( ".input" ) ;
4
+ // Animate Button Icon Change
5
+ const icon = document . querySelector ( ".fas" ) ;
4
6
5
7
btn . addEventListener ( "click" , ( ) => {
6
8
search . classList . toggle ( "active" ) ;
9
+ icon . classList . toggle ( "fa-search-plus" , ! search . classList . contains ( "active" ) ) ;
10
+ icon . classList . toggle ( "fa-times" , search . classList . contains ( "active" ) ) ;
7
11
input . focus ( ) ;
8
12
} ) ;
Original file line number Diff line number Diff line change @@ -48,10 +48,17 @@ body {
48
48
outline : none;
49
49
}
50
50
51
+ /* Change Background Color on Hover */
52
+
53
+ .input : focus {
54
+ background-color : # f0f0f0 ;
55
+ }
56
+
51
57
.search .active .input {
52
- width : 200px ;
58
+ /* Modify Expansion Width */
59
+ width : 300px ;
53
60
}
54
61
55
62
.search .active .btn {
56
- transform : translateX (198 px );
63
+ transform : translateX (248 px );
57
64
}
You can’t perform that action at this time.
0 commit comments