foundation-sites: Uncaught TypeError: Cannot read property 'sticky_class' of undefined
I am using Foundation with RoR. foundation-rails-5.5.1
If I navigate to one of the links in the top bar and then back, I get the following error:
Uncaught TypeError: Cannot read property 'sticky_class' of undefined
foundation.topbar.js, line 64: var sticky = topbarContainer.hasClass(settings.sticky_class);
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 17 (1 by maintainers)
+1 same issue here, FF5 with RoR (foundation-rails) … it prevents all javascript from working, you have to reload the page
line 64: var sticky = topbarContainer.hasClass(settings.sticky_class);
it spits out that settings is undefined, which is exactly what is happening - when you console.log the settings variable in the init function (foundation.topbar.js), sometimes you get an empty object… but sometimes you don’t, for example when you reload the page
// UPDATE: problem solved (for me) I had to wrap foundation this way in application.js to get rid of the error in the console
$(document).on(‘ready page:load’, function () { $(function(){ $(document).foundation(); }); });
it still didn’t solve the major problem, that my other javascript stopped working, but I ‘fixed’ it by using jQuery Turbolinks - basically just followed advices posted here https://github.com/zurb/foundation/issues/6438