ZURB Foundation Fixed Topbar 4 doesn´t work in mobile mode with URLs like www.mysite.com/segment1/segment2

575 views Asked by At

I use the fixed Topbar 4.3.1. On small screens (mobile mode) the Topbar will only expand, if the page I´m on has a URL like

www.mysite.com
www.mysite.com/segment1

If I´m on a page with a URL like

www.mysite.com/segment1/segment2 

the Topbar will not expand. Neither on click (browser window 800x600) nor on tap (Samsung Galaxy Tablet and Huawei Smartphone)

In destop mode all is fine. Here I can use URLs with 2 segments.

1

There are 1 answers

0
awa On

Fixed, it was the classic directory issue. Foundation stores Zepto, JQuery and foundation.min.js in js/vendor/

I have them in my install unter assets/js/vendor

Also my CMS wants a leading slash, so I need /assets/js/vendor. The JQuery-path had no assets/ and for all 3 scripts the slash in front of assests was missing. After I changed that, the menu works.

I use the firebug console to debug. The error

ReferenceError: $ is not defined

put me on the right path. If

<script>
    $(document).foundation();
  </script>

has issues, than something must be wrong here

<script>
   document.write('<script src=' +
   ('__proto__' in {} ? '/assets/js/vendor/zepto' : '/assets/js/vendor/jquery') +
   '.js><\/script>')
</script>
<script src="/assets/js/foundation.min.js"></script>

Those three Scripts are the foundation of Foundation. If one can´t be loaded, Foundation will not work properly