Cannot read swing properties undefined

I am using the CDN version of materializecss

<html>
    <head>
        <!-- css -->
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/css/materialize.min.css">
    </head>
    <body>
        <!-- page body -->

        <!-- scripts -->
        <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/js/materialize.min.js"></script>
        <script src="scripts/scripts.js"></script>
    </body>
</html>

and get the following error in the console

Uncaught TypeError: Unable to read swing property from undefined

at materialize.min.js: 6

(anonymous) @ materialize.min.js: 6

+4
source share
3 answers

It looks like Materialize is using the extension, so you will need the full version of jQuery - the thin version will not work.

+18
source

When you use the bootstrap material design,

<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">

<script
src="https://code.jquery.com/jquery-3.2.1.js"
integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE="
crossorigin="anonymous"></script>


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.4.1/css/mdb.min.css" />
</head>

And put the script file at the end of the body section:

<body>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.4.1/js/mdb.min.js"></script>

</body>

Remember to use the uncompressed version of jQuery as described above.

+1
source

Jquery.slim JQuery.

0

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


All Articles