File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -23,3 +23,28 @@ const app = new Vue({
2323
2424
2525require ( './bulma-extensions' ) ;
26+
27+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
28+ // Get all "navbar-burger" elements
29+ const $navbarBurgers = Array . prototype . slice . call ( document . querySelectorAll ( '.navbar-burger' ) , 0 ) ;
30+
31+ // Check if there are any navbar burgers
32+ if ( $navbarBurgers . length > 0 ) {
33+
34+ // Add a click event on each of them
35+ $navbarBurgers . forEach ( function ( $el ) {
36+ $el . addEventListener ( 'click' , function ( ) {
37+
38+ // Get the target from the "data-target" attribute
39+ let target = $el . dataset . target ;
40+ let $target = document . getElementById ( target ) ;
41+
42+ // Toggle the class on both the "navbar-burger" and the "navbar-menu"
43+ $el . classList . toggle ( 'is-active' ) ;
44+ $target . classList . toggle ( 'is-active' ) ;
45+
46+ } ) ;
47+ } ) ;
48+ }
49+
50+ } ) ;
You can’t perform that action at this time.
0 commit comments