I'm trying to write a simple JQuery function in order to animate my mobile navigation. However, I'm not sure how to format the .js file. I've looked up some examples online, but I couldn't get my function to work, when I tried to use the example templates. Here's what I'm currently using, which works in Chrome, but FireFox logs an error, which I'll also post below:
My code:
(function ($, Drupal) {
$(function(){
$( '#mobile-menu-toggle-button' ).click(function(){
$( '.mobile-menu-toggle' ).toggleClass( "open" );
});
$( '.overlay' ).click(function(e){
if(e.target != this) return;
$( '.mobile-menu-toggle' ).toggleClass( "open" );
});
});
})(jQuery, Drupal);
FireFox errors:
ReferenceError: Drupal is not defined
I'm thinking my formatting is off. Any help would be greatly appreciated.
core/drupal
as a dependancy?dependencies: - core/jquery - core/jquery.once