Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter lnorton059

    (@lnorton059)

    Hey,

    I contacted Divi and they said it’s due to their Minify CSS option. If you go into Divi settings and disable this WP Super Cache should work.

    Hope that helps!

    Thread Starter lnorton059

    (@lnorton059)

    resolved

    Thread Starter lnorton059

    (@lnorton059)

    I’ve just added the full path to the js file and it seems to now work.

    There must be a problem with get_template_directory_uri() which thinks my template directory is something other than what it is currently set to.

    Thread Starter lnorton059

    (@lnorton059)

    Hey,

    Just to explain. I was trying to create a menu structure for wordpress mobile structure which involved toggling classes to hide or reveal the sub menu. In order to Toggle the classes I needed to use jQuery. My original script would not work but I found a script online that used a delay function. For some reason jQuery fails to trigger on the mobile menu unless you use the time delay. Here is the new script that seems to work:

    <script type=”text/javascript”>
    (function ($) {

    function setup_collapsible_submenus() {

    $(“.lm-mobile-menu-back”).click(function () {
    $(“.visible”).removeClass(“visible”)
    });

    var $menu = $(‘#mobile_menu’),
    top_level_link = ‘#mobile_menu > .menu-item-has-children > a’;

    $menu.find(‘a’).each(function () {
    $(this).off(‘click’);

    if ($(this).is(top_level_link)) {
    $(this).attr(‘href’, ‘#’);
    }

    if (!$(this).siblings(‘.sub-menu’).length) {
    $(this).on(‘click’, function (event) {
    $(this).parents(‘.mobile_nav’).trigger(‘click’);
    });
    } else {
    $(this).on(‘click’, function (event) {
    event.preventDefault();
    $(this).parent().toggleClass(‘visible’);
    });
    }
    });
    }

    $(window).load(function () {
    setTimeout(function () {
    setup_collapsible_submenus();
    }, 700);
    });

    })(jQuery);
    </script>

    Obviously this is now using a combination of Toggle or remove but I’m not great at Javascript. Is there a cleaner way to write this?

    Thank you

    Thread Starter lnorton059

    (@lnorton059)

    Hi,

    No, sorry I should of explained. This was done just to test on desktop.

    The issue is you can’t apply anything to the mobile menu. Whether it be hover or click.

    Thanks ??

Viewing 5 replies - 1 through 5 (of 5 total)