This is the code.
jQuery(document).ready(function() {
jQuery( '#menu-item-927' ).on( 'ubermenuopen', function(){
jQuery('.site-content').addClass('blur');
});
});
It works when I use it in the console but does not work when in a JS file.
Here are the things I have tried:
- Enqueued script with jQuery dependency
wp_enqueue_script( 'script', get_stylesheet_directory_uri() . '/custom.js', array( 'jquery' ), '1.0.0', false );
and custom.js does show up in the source. - Added
jQuery(document).ready(function()
.
P.S: ubermenuopen is an events API from the UberMenu plugin.