Select Page

If you are using the slide-in menu with Divi theme and you also have a single-page website, that is, all your menu links point to the same page, then you will notice that when you click on any link in the menu, the page will scroll to its section, but the menu will remain open. This is a big usability issue since the slide-in menu covers most of the page and the site user must close it manually.

close divi slide-in menu on click

To make sure that the slide-in menu is closed as soon as you click on a link, add this code to Divi > Theme options > Integration > Add code to the of your blog,

<script><br />
(function($) {<br />
$(document).ready(function() {<br />
var menuItem = $('.menu-item a');</p>
<p>menuItem.each(function(){<br />
$(this).bind('click', function(){<br />
$('#et-top-navigation .mobile_menu_bar').trigger('click');<br />
})<br />
})<br />
});<br />
})(jQuery)<br />
</script>

This code will close the slide-in menu when a menu item in it is clicked.