somewebmedia / hc-offcanvas-nav

JavaScript library for creating toggled off-canvas multi-level navigations, allowing endless nesting of submenu elements, supporting swipe gestures, keyboard interactions and ARIA attributes.
https://somewebmedia.github.io/hc-offcanvas-nav/
MIT License
336 stars 82 forks source link

WordPress and Gravity Forms conflict [Mobile Only] #96

Open MAC-miles-tech opened 1 year ago

MAC-miles-tech commented 1 year ago

Hello,

I have used this script on a WordPress website, and everything seemed to work great on the development environment. We tested extensively, but when we launched, we ran into an odd error. Actually, its the lack of error that is odd. The menu will not open on mobile only on the pages listed below. All caching has been turned off on the website. When I use browserstack, I dont see an error. When I use the inspect tool, I also see no errors. I have reached out to Gravity Forms and they said to reach out to you (typical). I have run npm update recently, which would give me an updated version of the code. I am not sure what other steps to take.

Sporadically, I find this error or something similar. https://share.gravityfor.ms/i/ReewAd

The website is: https://www.amo-union.org/ Example page where menu is not working: https://www.amo-union.org/contact-dispatching/ https://www.amo-union.org/membership-application/

tametheone commented 1 year ago

Hi, can You provide some code?

MAC-miles-tech commented 1 year ago

Here is the snippet I use to activate the hc-offcanvas-menu:

`jQuery(document).ready(function($) {

$('#main-nav').hcOffcanvasNav({
    disableAt: 992,
    customToggle: $('.toggle'),
    levelSpacing: 40,
    navTitle: $('<img src="/wp-content/themes/AMO-union/images/amo-logo.svg" alt="American Maritime Officers" width="125" height="125">'),
    levelTitles: true,
    levelTitleAsBack: true,
    pushContent: '#page-container',
    position: 'right',
    insertClose: false,
    levelSpacing: 0,
});

});`

Other than that I use a custom WordPress menu walker to spit out the code as you see it on the front-end. Since submitting this ticket, it seems that there is some different behavior. The sporadic error I mentioned above has become persistent with every load. I am seeing the mobile nav toggle bars on all screen sizes on the pages linked above as well.

image

The code between pages with errors and without errors seem to be slightly different as well. Notice the mobile menu toggle has a bunch of classes and attributes on about us, but not on contact dispatching. I think the error is preventing the code from behaving as expected. Do you know where this error is originating?

/contact-dispatching image

/about-us image