Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Foundation 6 core js error

I am using a brand new install of Foundation 6 and trying to set up a closable toggle box (http://foundation.zurb.com/sites/docs/toggler.html).

For some reason I am getting this error though..

Uncaught TypeError: Cannot read property '_init' of undefined

on line 245 of foundation.core.js.

This is the HTML on my page, straight from the closable example in the Foundation docs..

<div class="callout" data-closable>
  <button class="close-button" data-close>&times;</button>
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Labore praesentium sint alias dolorum qui vel quaerat, libero consequatur non esse asperiores veritatis commodi, odit eum ipsam nemo dicta iste aliquam.</p>
</div>

This is the javascript I have at the bottom of my HTML before the </body>.

<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/foundation-sites/js/foundation.core.js"></script>
<script src="bower_components/foundation-sites/js/foundation.toggler.js"></script>
<script>
    $(document).foundation();
</script>

I'm not sure what I'm doing wrong here or what I'm missing. Everything works if I load the entire Foundation javascript library but that's complete overkill for what I need.

like image 245
Dustin Avatar asked Sep 26 '22 22:09

Dustin


1 Answers

I had this error with multiple plugins from Foundation 6. After doing some searching and reading, it turned out that foundation.core has a co-dependency with foundation.util.mediaQuery.

Try inserting foundation.util.mediaQuery after foundation.core.

like image 128
Vadim Avatar answered Oct 12 '22 02:10

Vadim