Search code examples
javascripthtmlmaterialize

cannot read property swing of 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 getting the following error in console

Uncaught TypeError: Cannot read property 'swing' of undefined

at materialize.min.js:6

(anonymous) @ materialize.min.js:6


Solution

  • It looks like Materialize uses extend, so you'll need the full version of jQuery - the slim version will not work.