Drilldown menu not working on 6.4.3

Hi All,

In my Rails 5 application, with foundation version 6.4.3. the drill down menus are not working.

I copied the source as provided in the documentation example, but the menus are displayed as is without drill down functionality.

any help on how to fix this would be really great, Thanks.

Rails 5 uses a technology named Turbolinks. When you go back and forth between pages of your site, the whole page is not totally reloaded (only the <body>...</body> section is. The remaining (aka javascript, css etc.) is not.

DrillDown is a javascript component that must be “activated” once the page is fully loaded. Somewhere in your Javascript code (typically in the "app/asset/javascript/application.js), you’ll find something like:

  $(document).foundation();

That could look like this:

$(window).load(function() {
  $(document).foundation();
});

or even

$(window).bind("load", function() {
  $(document).foundation();
});

With Turbolink, calling $(document).foundation() when the page has finished loading is not enough. You need to call this code each time Turbolinks has loaded its part:

  $(document.bind("turbolinks:load", function() {
    $(document).foundation();
});