I made a wordpress page with divi and want to close the nav-menu when the user clicks outside. How can I achieve this?
Here is the code (I think this part is relevant)
<div id="et_mobile_nav_menu">
<div class="mobile_nav closed">
<span class="select_page">Seite auswählen</span>
<span class="mobile_menu_bar mobile_menu_bar_toggle"></span>
and my actual script looks like that
<script type="text/javascript">
(function($) {
$(document).ready(function() {
console.log('onReady');
$(document).on('click','.mobile_menu_bar_toggle',function(){
console.log('working?');
});
});
})(jQuery);
</script>
Because the drawer-toggle gets added dynamically, I better choose the "on"-method to interact with it, right?
As always, thanks in advance.