CMS Development

lformdesign
Participant

Hubspot adding unwanted javascript that interferes with custom navigation

SOLVE

We have a custom navigation on our client's hubspot site, but it recently became problematic. After troubleshooting the various scripts, enabling, disabling them, the problem was traced by to a javascript file being loaded with the site, that is not part of the site assets or in any of the folders:

/hs/hsstatic/keyboard-accessible-menu-flyouts/static-1.2/bundles/project.js

It seems to be included with the standard_footer_includes and is not found in either the site footer script settings, nor the pages script settings.

Its adding mouseout events that interfere with the menu, is there any way to remove or disable this script?

1 Accepted solution
tjoyce
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Hubspot adding unwanted javascript that interferes with custom navigation

SOLVE

Unfortunately @roisinkirby, this is not a belch.io template. I do have a quick fix for this though. I believe that projects.js script is a standard HS script that's added to every template. The good news is that the script is targeting childrend directly of the "hs-menu-wrapper" class. So, a quick fix would be to drop this javascript into the template and then do a hard refresh in the browser.

$(function(){
  $('.hs-menu-wrapper').removeClass('hs-menu-wrapper');
});

And, even better news is that they don't appear to be using that class selector in any css styles. So, this might end up being a permanent fix.

 


tim@belch.io

View solution in original post

7 Replies 7
roisinkirby
HubSpot Product Team
HubSpot Product Team

Hubspot adding unwanted javascript that interferes with custom navigation

SOLVE

@lformdesign could you please share a link to the site you are working on and confirm if you are using custom coded templates, HubSpot's drag and drop templates or a template you purchased from the HubSpot Marketplace?

lformdesign
Participant

Hubspot adding unwanted javascript that interferes with custom navigation

SOLVE

Thanks for the reply, the site is https://www.redirectconsulting.com/

The templates are custom coded.

You can see the issue happening by clicking on 'Services' or 'Solutions', when the dropdown appears, if you move the mouse out of the <a> tag, the dropdown closes due to the mouseout event in that script I previously mentioned: https://www.redirectconsulting.com/hs/hsstatic/keyboard-accessible-menu-flyouts/static-1.2/bundles/p...

 

Also, here is the menu template code for the navigation:

 

{% menu id=XXX, overrideable='false', no_wrapper='true', max_levels='3', flyouts='false' %}

 

 

roisinkirby
HubSpot Product Team
HubSpot Product Team

Hubspot adding unwanted javascript that interferes with custom navigation

SOLVE

Did you originally develop these templates? @Jsum, @tjoyce are have you seen this script before?

0 Upvotes
lformdesign
Participant

Hubspot adding unwanted javascript that interferes with custom navigation

SOLVE

@roisinkirbyThe template is original & custom coded by our team, we are not using any pre-fab templates or bits.

 

I can confirm that the fix suggested by @tjoyce works, much appreciated.

 

On Hubspot's end, it would be preferable however if setting flyouts='false' in the menu template function prevented that flyouts script from loaded altogether, or at least not initiate its event bindings. As it stands, that parameter seems to be more of a kind suggestion to the templating system rather than a hard setting. The fix @tjoyce came up with works but is a wee bit hacky in the context of the templating system.

 

Thanks again for the help @roisinkirby and @tjoyce.

chloekonig
Member

Hubspot adding unwanted javascript that interferes with custom navigation

SOLVE

Thank you for the solution, @tjoyce! Our site is experiencing the same problem, however, the fix won't work because it interferes with our CSS. Does anybody have any other solutions? The site that I am currently experiencing problems with is https://www.wellable.co/seminars-webinars. 

 

Thank you! 

This is how it looks like with the functionThis is how it looks like with the function

0 Upvotes
tjoyce
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Hubspot adding unwanted javascript that interferes with custom navigation

SOLVE

Unfortunately @roisinkirby, this is not a belch.io template. I do have a quick fix for this though. I believe that projects.js script is a standard HS script that's added to every template. The good news is that the script is targeting childrend directly of the "hs-menu-wrapper" class. So, a quick fix would be to drop this javascript into the template and then do a hard refresh in the browser.

$(function(){
  $('.hs-menu-wrapper').removeClass('hs-menu-wrapper');
});

And, even better news is that they don't appear to be using that class selector in any css styles. So, this might end up being a permanent fix.

 


tim@belch.io
ogavrilov
Participant

Hubspot adding unwanted javascript that interferes with custom navigation

SOLVE

Can you please look more into that issue? It breaked our site's critical navigation flyouts. Why this script is included without any possibility to disable it?

0 Upvotes