1. CYBER MONDAY SALE All Access Pass @ $59 / Lifetime & access all our 16+ premium Divi extensions: Divi Block Pro, Carousel Toolkit, etc.LEARN MORE
Dismiss Notice
NEW Divi.Help Pro Carousel AI Toolkit - Magically turn your Divi design into carousel, simply by using our online toolkit. No plugins needed. Now it works with Divi 5 as well!Try our carousel AI toolkit
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well. Also newly added AI generator & color. Now it works with Divi 5 as well!
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

Solved Close slide in menu when clicking outside

Discussion in 'Free Divi Community Forum' started by Roxanne44, Nov 30, 2025.

  1. Roxanne44

    Roxanne44 New Member

    Hi all,
    I followed this Divi tutorial to create a slide in menu - https://www.elegantthemes.com/blog/...onsive-slide-in-menu-with-divis-theme-builder

    All is working well except for one extra thing I need. I want the menu to close when I click outside the menu, not just when I click the close(x) icon.

    I found a previous thread in this forum (https://divi.help/threads/close-the-slide-after-click-outside-of-the-slide.12629/) that suggested adding some code snippets but neither worked.

    Does anyone have any tips on how I might achieve this?

    The menu is on this page here - https://rdconsulting.com.au/new-home-draft/

    Appreciate any insights.
    Cheers
    Roxanne
     
    1. PRO MEMBER PERKS Beautifully crafted custom colored 'Industrial' Divi layout for all Pro members:View Demo
  2. Roxanne44

    Roxanne44 New Member

    In case this is helpful for anyone else with the same issue - Elegant Themes came through with a fix for this -

    Please edit the Code Module from the template and replace this JavaScript code: (see screenshot)
    [​IMG]

    With this one:



    <script>
    jQuery(function($){
    $('#slide-in-open').click(function(){
    $(this).toggleClass('open');
    $('.slide-in-menu-container').toggleClass('slide-in-menu');
    });
    $(document).on('click', function(e) {
    if ($('.et-l.et-l--header .slide-in-menu-container').hasClass('slide-in-menu')) {
    if (!$(e.target).closest('.et-l.et-l--header .slide-in-menu-container').length && !$(e.target).closest('#slide-in-open').length) {
    $("#slide-in-open").toggleClass('open');
    $('.slide-in-menu-container').toggleClass('slide-in-menu');
    }
    }
    });
    });
    </script>


    Worked a treat for me.
     

    Attached Files: