# Website not mobile optimized - links with anchor does not work

**URL:** <https://community.hubspot.com/t/website-not-mobile-optimized-links-with-anchor-does-not-work/8226>\
**Category:** CMS Development\
**Created:** [March 22, 2018, 11:44am UTC](https://community.hubspot.com/t/website-not-mobile-optimized-links-with-anchor-does-not-work/8226 "2018-03-22T11:44:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thewalk44](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/thewalk44/32/39512_2.png) [@Thewalk44](https://community.hubspot.com/u/Thewalk44)\
**Post date:** [March 22, 2018, 11:44am UTC](https://community.hubspot.com/t/website-not-mobile-optimized-links-with-anchor-does-not-work/8226/1 "2018-03-22T11:44:54Z")

</div>

Hi,

My name is Erik and I´ve bought a customized theme package from HubSpots partner -The Hubguru. They don´t reply on any mails what so ever and i am in urgent need for help.

My website are now finished, but when shown on mobile it does not work correctly.

I can see that the following does not work when you press the menu bar in the top right corner when using mobile phone:

1. Link to “fornøyde kunder = satisfied customers”

2. Link to “om oss = about us”

Link to website: [www.thewalk.no](http://www.thewalk.no) (mobile version).

The support team at HubSpot has been amazing throughout this whole process, but i have been told that the reason for this error, is that the anchor link is working but the menu will not close. I need help to add a script that will close out the menu after someone clicks a link on it.

Is there someone out there that please could help me fixing these issues?

Best regards,

Erik.

---

<div class="post-metadata">

**Author:** ![RMR](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rmr/32/76731_2.png) [@RMR](https://community.hubspot.com/u/RMR)\
**Post date:** [March 23, 2018, 5:56pm UTC](https://community.hubspot.com/t/website-not-mobile-optimized-links-with-anchor-does-not-work/8226/2 "2018-03-23T17:56:36Z")

</div>

Hey @Thewalk44,

Edit your Custom/page/Moose\_Theme\_2017/Moose\_Script.js file and paste this at the bottom, after everything else:

```auto
$(function() {
 $('.mainmenu a[href*="#sec"]').on('click', function() {
 $('body').removeClass('mobile-open');
 $('.mainmenu .hs-menu-wrapper').slideUp();
 });
});

```

Hope it works.

Best,

-Radu

---

<div class="post-metadata">

**Author:** ![Thewalk44](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/thewalk44/32/39512_2.png) [@Thewalk44](https://community.hubspot.com/u/Thewalk44)\
**Post date:** [March 23, 2018, 6:06pm UTC](https://community.hubspot.com/t/website-not-mobile-optimized-links-with-anchor-does-not-work/8226/3 "2018-03-23T18:06:42Z")

</div>

Hi,

Thanks man 🙂 Much appreciated!

Hopefully it will work.

Best,

Erik.

---

<div class="post-metadata">

**Author:** ![RMR](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rmr/32/76731_2.png) [@RMR](https://community.hubspot.com/u/RMR)\
**Post date:** [March 23, 2018, 6:07pm UTC](https://community.hubspot.com/t/website-not-mobile-optimized-links-with-anchor-does-not-work/8226/4 "2018-03-23T18:07:14Z")

</div>

I think you also need to add this to the CSS file (also after everything else) to prevent affecting the desktop version:

```auto
@media (min-width: 768px) {
 .mainmenu .hs-menu-wrapper {
 display: block !important;
 overflow: visible !important;
 }
}

```

---

<div class="post-metadata">

**Author:** ![Thewalk44](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/thewalk44/32/39512_2.png) [@Thewalk44](https://community.hubspot.com/u/Thewalk44)\
**Post date:** [March 23, 2018, 6:10pm UTC](https://community.hubspot.com/t/website-not-mobile-optimized-links-with-anchor-does-not-work/8226/5 "2018-03-23T18:10:12Z")

</div>

Great! Thank you so much.

You saved the day 🙂

Best,

Erik.

---

<div class="post-metadata">

**Author:** ![Thewalk44](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/thewalk44/32/39512_2.png) [@Thewalk44](https://community.hubspot.com/u/Thewalk44)\
**Post date:** [March 25, 2018, 3:39pm UTC](https://community.hubspot.com/t/website-not-mobile-optimized-links-with-anchor-does-not-work/8226/6 "2018-03-25T15:39:53Z")

</div>

Thanks for the effort and help, it finally works 🙂

Best regards,

Erik.
