[Resolved] Mobile Menu not working

Home Forums Support [Resolved] Mobile Menu not working

Home Forums Support Mobile Menu not working

Viewing 8 posts - 31 through 38 (of 38 total)
  • Author
    Posts
  • #1538458
    David

    Yes, I found the culprit. I have an element named:

    JS: Passive Event Listeners

    That is conflicting. When I turn this to Draft the menus work fine.

    #1538460
    David

    Here is the script that conflicts with the menus:

    <script>
    (function() {
    var supportsPassive = eventListenerOptionsSupported();

    if (supportsPassive) {
    var addEvent = EventTarget.prototype.addEventListener;
    overwriteAddEvent(addEvent);
    }

    function overwriteAddEvent(superMethod) {
    var defaultOptions = {
    passive: true,
    capture: false
    };

    EventTarget.prototype.addEventListener = function(type, listener, options) {
    var usesListenerOptions = typeof options === ‘object’;
    var useCapture = usesListenerOptions ? options.capture : options;

    options = usesListenerOptions ? options : {};
    options.passive = options.passive !== undefined ? options.passive : defaultOptions.passive;
    options.capture = useCapture !== undefined ? useCapture : defaultOptions.capture;

    superMethod.call(this, type, listener, options);
    };
    }

    function eventListenerOptionsSupported() {
    var supported = false;
    try {
    var opts = Object.defineProperty({}, ‘passive’, {
    get: function() {
    supported = true;
    }
    });
    window.addEventListener(“test”, null, opts);
    } catch (e) {}

    return supported;
    }
    })();
    </script>

    #1538462
    Leo
    Staff
    Customer Support

    I’m not sure what the script is supposed to do.

    Where did you get it from? Is it still needed?

    and am I correct to assume that the other topic is resolved as well?
    https://generatepress.com/forums/topic/primary-menu-not-working-right/

    #1538463
    David

    I’m sure it is the same issue. I added passive listeners because of this

    https://stackoverflow.com/questions/45974128/wordpress-and-best-practice-with-passive-event-listeners

    #1538464
    David

    I already know how GeneratePress works and already troubled shooted my plugins, but then I forget to look at the Elements and check them for conflicts. I am so sorry.

    #1538465
    Leo
    Staff
    Customer Support

    I don’t think you need that snippet – it’s never a good idea to add random snippets you found online without understanding how it works and the conflicts it could cause.

    I’ll close both topics now.

    #1538467
    David

    It is not a random script. It is useful if someone is trying to use Elementor Pro. I was seduced by Elementor Pro last week, but then came back to my senses. I know longer use it so I do not have a use for that script anymore. But it was not random.

    Thank you for your time.

    #1538469
    Leo
    Staff
    Customer Support
Viewing 8 posts - 31 through 38 (of 38 total)
  • The topic ‘Mobile Menu not working’ is closed to new replies.