46
46
{% endif %}
47
47
-->
48
48
49
-
50
49
< ul class ="hidden-links hidden "> </ ul >
51
50
<!-- Burger button - span class for screen readers-->
52
51
< button class ="hamburger__btn-toggle " type ="button " count ="1 " aria-expanded ="false ">
56
55
</ nav >
57
56
</ div >
58
57
</ div >
59
- </ div >
60
-
61
-
62
- < script src ="https://code.jquery.com/jquery-3.6.1.min.js " integrity ="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ= " crossorigin ="anonymous "> </ script >
63
-
64
- <!-- This works now but when you open the menu its not saying aria expanded or
65
- prompting the screen reader-->
66
- < script >
67
- $ ( document ) . ready ( function ( ) {
68
- $ ( ".hamburger__btn-toggle" ) . click ( function ( e ) {
69
- $ ( this ) . toggleClass ( "close" ) ;
70
- // toggle expanded to try on click
71
- $ ( this ) . attr ( 'aria-expanded' , function ( i , attr ) {
72
- return attr == 'true' ? 'false' : 'true' } ) ;
73
-
74
- e . preventDefault ( ) ;
75
- $ ( ".nav__links" ) . toggleClass ( "vertical" ) ;
76
- } ) ;
77
-
78
- $ ( ".dropdown" ) . click ( function ( e ) {
79
- // close when user clicks nav
80
- $ ( this ) . find ( ".dropdown-content" ) . toggleClass ( "open" ) ;
81
- // Handle making sure other drop menus are "closed" when another is open
82
- $ ( this ) . siblings ( ".dropdown" ) . find ( ".dropdown-content" ) . removeClass ( "open" ) ;
83
- $ ( this ) . siblings ( ".dropdown" ) . find ( ".dropbtn" ) . attr ( "aria-expanded" , "false" ) ;
84
-
85
- // this works but if user clicks on another drop down it should also return to closed
86
- // with this code it just toggles the next thing that the user clicks so both
87
- // dropdowns are set to expanded:true
88
- $ ( this ) . find ( ".dropbtn" ) . attr ( 'aria-expanded' , function ( i , attr ) {
89
- return attr == 'true' ? 'false' : 'true' } ) ;
90
- } ) ;
91
-
92
- // Close dropdown when u click outside of the nav ul
93
- $ ( document ) . click ( function ( e ) {
94
- if ( ! e . target . closest ( "ul" ) && $ ( ".dropdown-content" ) . hasClass ( "open" ) ) {
95
- $ ( ".dropdown-content" ) . removeClass ( "open" ) ;
96
- }
97
-
98
-
99
- } ) ;
100
- } ) ;
101
-
102
- </ script >
58
+ </ div >
0 commit comments