ProLuck
ProLuck

Reputation: 375

How to Install and use jquery-ui in laravel mix using npm

I'm confused about the usage of jquery-ui, I have already followed some instructions regarding "how to install jquery-ui using npm for laravel mix", however I still get an error and I don't know if I have made a mistake with the installation, I'm hoping I can receive some help with my problem.

To install jQuery, I used the following npm command:

npm install jquery-ui --save-dev

And for the imports to use jQuery (I'm using them in my_file.js and not in app.js):

import $ from "jquery";
window.$ = window.jQuery = $;

import "jquery-ui/ui/widgets/datepicker.js";
import "jquery-ui/ui/widgets/slider.js";

As for my code, I want to make a sliding effect when my button is clicked:

$("#right-arrow").on("click", function() {
  cardLength.slice(0, oddEven).toggle('slide', {
      direction: 'left'
  }, 1000);
});

I then run the command:

npm run dev

Upon doing so, I get this error in the console:

VM1005 collection.js:11247 Uncaught TypeError: jQuery.easing[this.easing] is not a function
at init.run (VM1005 collection.js:11247)
at tick (VM1005 collection.js:11631)
at Function.jQuery.fx.tick (VM1005 collection.js:11973)
at schedule (VM1005 collection.js:11350)

Upvotes: 1

Views: 1853

Answers (1)

Skully
Skully

Reputation: 3116

To make use of easing effects from jQuery, you need to import a seperate library called jQuery Easing: https://www.npmjs.com/package/jquery.easing

Upvotes: 1

Related Questions