question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jQuery.easing[jQuery.easing.def] is not a function

See original GitHub issue

When I do

$(".dropdown-button").dropdown();

the dropdown opens fine, but when I click somewhere else and it’s time for the dropdown to close it says

jQuery.easing[jQuery.easing.def] is not a function

I’m using these versions:

https://code.jquery.com/jquery-2.1.1.min.js
https://cdnjs.cloudflare.com/ajax/libs/materialize/0.96.1/js/materialize.min.js

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
m-gvcommented, Mar 16, 2016

It turned out one of the dependencies in my project was using 2.1.3. This version of JQuery no longer seems to set JQuery.easing.def to easeOutQuad by default, thus there will be an undefined error.

I solved this by forcing materialize to use JQuery 2.1.1 in the following way:

<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript"> 
     $materialize = jQuery.noConflict(true); 
</script> 

Inside materialize.js:

if (typeof(jQuery) === 'undefined') {
  var jQuery;
  // Check if require is a defined function.
  if (typeof(require) === 'function') {
    jQuery = $materialize = require('jQuery');
  // Else use the dollar sign alias.
  } else {
    jQuery = $materialize;
  }
};

However now it is no longer possible to use the CDN version and to update without making changes to the materialize file. People working on the project after me will likely run into issues with the way I am currently solving it.

It would be great to get an official statement from @Dogfalo on how you should use materialize while you you have external modules which are using other versions of JQuery. (I don’t have access to those extrernal modules)

EDIT: This did not actually end up solving the issue for me, since the external dependency also loads JQuery using Java. When this happened, JQuery was again being replaced with the newer version 2.1.3: thus also the word JQuery inside Materialize gets replaced by version 2.1.3, instead of staying 2.1.1.

The context gets lost and JQuery.easing.def becomes undefined. I was able to solve this by putting the whole easing plugin inside of the following tags:

(function($, undefined) {
<easing plugin here>
}) (jQuery);

and replacing the word JQuery with $ in the easing plugin code.

(as suggested here: https://stackoverflow.com/questions/11533168/jquery-easingjquery-easing-def-is-not-a-function)

Would be great to see how this could be standardized though, so that me and others can keep using the standard version of materialize.

2reactions
angrykoalacommented, Jul 20, 2017

This is happening to me with materialize-css@0.100.0 and 0.99.0 (it wasn’t happening before)

Adding jqueryUI <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> seems to fix the problem, however I don’t understand why or if there is a better fix.

I’m using materialize as part of an electron app, and I prefer to use only npm based packages

Read more comments on GitHub >

github_iconTop Results From Across the Web

jQuery.easing[jQuery.easing.def] is not a function
To save everyone some time. Open your Jquery easing plugin file and wrap the code inside: $(document).ready(function() { Code goes here... });.
Read more >
jQuery.easing[jQuery.easing.def] is not a function - MDBootstrap
I'm having the same issue. Generically the issue seems to be relate to not have jQuery UI, but I have placed jQuery UI...
Read more >
jQuery.easing[jQuery.easing.def] is not a function - YouTube
jQuery : jQuery. easing[jQuery. easing. def] is not a function [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] jQuery ...
Read more >
jQuery.easing[jQuery.easing.def] is not a function using ASP ...
TypeError : jQuery.easing[jQuery.easing.def] is not a function using ASP. ... When I am executing my application, the slider is not showing ...
Read more >
jQuery.easing[jQuery.easing.def] is not a function | Themeco ...
cs-body.min.js?ver=1.2.4:1 Uncaught TypeError: jQuery.easing[jQuery.easing.def] is not a function. this is a Cornerstone file, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found