cannot read property swing of undefined

10,115

Solution 1

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

Solution 2

When you use material Design Bootstrap,

<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 Script File at end of "body" section:

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

</body>

Don't forget to use uncompressed version of JQuery as mentioned above.

Solution 3

Just change the Jquery.slim to a normal Jquery. It works with me

Solution 4

Use 'jquery-3.5.1.min.js' instead of 'jquery-3.5.1.slim.min.js'. It worked for me.

Share:
10,115

Related videos on Youtube

Aman Kumar
Author by

Aman Kumar

Updated on May 10, 2020

Comments

  • Aman Kumar
    Aman Kumar almost 4 years

    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

  • Ignacio Correia
    Ignacio Correia about 6 years
    Fixed my jQuery easing problem with BS4 :). Boostrap uses the slim version by default I changed to the full jQuery and voila!

Related