Menu don't load properly

HI , i have developed a lot of web site with foundation, but in all i have problems in loading menu;
it freezes exploded, showing the hamburger menu and all unders levels menu .

of sure is a my error, but i really not understand what i have fall.

can you surf in the following link and give me a tips?


https://www.retevaldarno.it/index.php

Enrico

See the developer tools of your browser, there is an error. Also you use an outdated version of foundation-sites, 6.6.3 is the latest version.

addBack is a jQuery method which was introduced in jQuery 1.8: https://api.jquery.com/addBack/

The error may happen because you do not wait until the DOM is ready:

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

Try this:

<script>
$(function() {
      $(document).foundation();
});
</script>

https://api.jquery.com/ready/

Ok. thank you, it seem working better; i have also moved this script form footer to head,
is correct?

In general no, scripts should be right before the closing body tag, not in the head section, otherwise you have longer loading times and other issues.

But best is you test it in your setup.

Ok… thank !
i have tried it but , i 'll following your tips, seem more fast form google test .
Enrico

The perceived performance might be worse because of the longer loading times. See https://stackoverflow.com/a/8249046/753676 and other discussions about this.

Ok, the problem seem the cookies consent script, i have move it at the footer at the dom , and now all seem working correctly .

Thank you
Enrico

1 Like