creativetimofficial / black-dashboard

MIT License
344 stars 313 forks source link

Perfect Scrollbar jQuery Compatibility/Documentation #24

Open Okomikeruko opened 4 years ago

Okomikeruko commented 4 years ago

The documentation for integrating Perfect Scrollbar v1.4.0 shows jQuery based interactions. See here

However, when I attempt to use the following code: $('.scroll-window').perfectScrollbar();

I get the following error: Uncaught TypeError: $(...).perfectScrollbar is not a function.

However, this code works: const ps = new PerfectScrollbar(".scroll-window");

Despite the included file being called /perfect-scrollbar.jquery.min.js it seems they've discontinued jQuery support.

rarestoma commented 4 years ago

Hi @Okomikeruko,

Thank you for working with our products.

The plugin has been updated and now this has to be initialized this way:

const container = document.querySelector('#container');
const ps = new PerfectScrollbar(container);

// or just with selector string
const ps = new PerfectScrollbar('#container');

We will change our documentation for the perfect scrollbar in our next update.

I hope it helps.

All the best, Rares