File tree Expand file tree Collapse file tree 2 files changed +94
-0
lines changed
Expand file tree Collapse file tree 2 files changed +94
-0
lines changed Original file line number Diff line number Diff line change 1616 top : 2.5% ;
1717 opacity : 1 ;
1818 }
19+ }
20+
21+ .old-out {
22+ animation-name : oldOut;
23+ animation-duration : .3s ;
24+ animation-fill-mode : forwards ;
25+ }
26+
27+ @keyframes oldOut {
28+ from {
29+ left : 0 ;
30+ }
31+ to {
32+ left : -100% ;
33+ }
34+ }
35+
36+ .old-in {
37+ animation-name : oldIn;
38+ animation-duration : .3s ;
39+ animation-fill-mode : backwards ;
40+ }
41+
42+ @keyframes oldIn {
43+ from {
44+ left : 0 ;
45+ }
46+ to {
47+ left : -100% ;
48+ }
49+ }
50+
51+ .new-out {
52+ animation-name : newOut;
53+ animation-duration : .3s ;
54+ animation-fill-mode : forwards ;
55+ }
56+
57+ @keyframes newOut {
58+ from {
59+ right : -10px ;
60+ }
61+ to {
62+ right : -100% ;
63+ }
64+ }
65+
66+ .new-in {
67+ animation-name : newIn;
68+ animation-duration : .3s ;
69+ animation-fill-mode : forwards ;
70+ }
71+
72+ @keyframes newIn {
73+ from {
74+ right : -100% ;
75+ }
76+ to {
77+ right : -10px ;
78+ }
1979}
Original file line number Diff line number Diff line change 1+
2+
3+ function DropdownForwardMenu ( from , to ) {
4+
5+ let fromElement = document . getElementById ( from ) ;
6+ removeUnusedClasses ( fromElement ) ;
7+
8+ let toElement = document . getElementById ( to ) ;
9+ removeUnusedClasses ( toElement ) ;
10+
11+ fromElement . classList . add ( 'old-out' ) ;
12+ toElement . classList . add ( 'new-in' ) ;
13+
14+ }
15+
16+ function DropdownBackwardMenu ( from , to ) {
17+
18+ let fromElement = document . getElementById ( from ) ;
19+ removeUnusedClasses ( fromElement ) ;
20+
21+ let toElement = document . getElementById ( to ) ;
22+ removeUnusedClasses ( toElement ) ;
23+
24+ fromElement . classList . add ( 'new-out' ) ;
25+ toElement . classList . add ( 'old-in' ) ;
26+ }
27+
28+ function removeUnusedClasses ( element ) {
29+
30+ element . classList . contains ( 'old-out' ) ? element . classList . remove ( 'old-out' ) : null ;
31+ element . classList . contains ( 'old-in' ) ? element . classList . remove ( 'old-in' ) : null ;
32+ element . classList . contains ( 'new-out' ) ? element . classList . remove ( 'new-out' ) : null ;
33+ element . classList . contains ( 'new-in' ) ? element . classList . remove ( 'new-in' ) : null ;
34+ }
You can’t perform that action at this time.
0 commit comments