Foundation Top-Bar Nav not opening on Mobile View

Hi I have built a theme using foundation 5, currently having problems with my navigation.

It happens on a mobile device. When on home page and you click on the menu it opens properly, if you go to any of the top and second level pages (for example About Us or Contact Us) and then click on the menu again. It does not open. It does open if you are on a third level page.

What I don't understand is that it works on some pages and not on others.

Can anyone have a look and see what might be the problem

Below is the code I used in the auto nag template.

<?php defined('C5_EXECUTE') or die("Access Denied.");
$navItems = $controller->getNavItems();
$c = Page::getCurrentPage();
foreach ($navItems as $ni) {
$classes = array();
   if ($ni->inPath) {
      $classes[] = 'nav-path-selected';
   if ($ni->hasSubmenu) {
      $classes[] = 'has-dropdown';
   $ni->classes = implode(" ", $classes);
   echo '<nav class="top-bar" data-topbar role="navigation">';
   echo ' <ul class="title-area">';

View Replies:
agentorange replied on at Permalink Reply
Does anyone have any ideas?
jordif replied on at Permalink Reply

it seems your theme is not loading jQuery.

The menu is working on your homepage because the image slider is loading jQuery, but it's not working on the other pages because jQuery is not included.

In concrete 5.7 jQuery is not loaded by default. You need to add the following code to your page_theme.php file if you want to include jQuery:

public function registerAssets()
    $this->requireAsset('javascript', 'jquery');

More information:

HOpe this helps,

agentorange replied on at Permalink Reply
Thanks so much for your response. Including the javascript worked.