- This topic has 37 replies, 2 voices, and was last updated 3 years, 5 months ago by Leo.
-
AuthorPosts
-
November 19, 2020 at 9:26 pm #1538458David
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.
November 19, 2020 at 9:27 pm #1538460DavidHere 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>November 19, 2020 at 9:28 pm #1538462LeoStaffCustomer SupportI’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/November 19, 2020 at 9:29 pm #1538463DavidI’m sure it is the same issue. I added passive listeners because of this
November 19, 2020 at 9:31 pm #1538464DavidI 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.
November 19, 2020 at 9:31 pm #1538465LeoStaffCustomer SupportI 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.
November 19, 2020 at 9:36 pm #1538467DavidIt 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.
November 19, 2020 at 9:37 pm #1538469LeoStaffCustomer SupportNo problem 🙂
-
AuthorPosts
- The topic ‘Mobile Menu not working’ is closed to new replies.