Foundation Core 6 Error

I am using a completely new installation of Foundation 6 and trying to set up a closing switch ( http://foundation.zurb.com/sites/docs/toggler.html ).

For some reason, I get this error though ..

Uncaught TypeError: Cannot read property '_init' of undefined

on line 245 of the foundation.core.js file.

This is HTML on my page, right from the closing example in Foundation documents.

 <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 that I have at the bottom of my HTML, before </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 am missing. Everything works if I load the entire JavaScript library in JavaScript, but this is a complete overflow for what I need.

+5
source share
3 answers

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

Try pasting foundation.util.mediaQuery after foundation.core .

+4
source

I believe this does not work for you because you do not have ui js or css movements. Turn on and try, I think you will be happy.

Actually, the foundation.util.motion.js file is missing, but it just won’t fix it, you will also need the ui css file for the movement.

0
source

I had the same problem, and after trying to solve it with npm (disappointed), I just imported jQuery into my HTML.

Follow this link and copy the Google CDN

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

and paste it into your HTML before importing the basic scripts. I hope this helps someone who still has this problem. Hooray!

0
source

Source: https://habr.com/ru/post/1238290/


All Articles