creativetimofficial / paper-dashboard

Paper Dashboard is a Bootstrap Admin Panel which combines soft colors with beautiful typography and spacious cards and graphics.
MIT License
361 stars 428 forks source link

[Bug] $(...).perfectScrollbar is not a function TypeError #51

Open sknoops opened 3 years ago

sknoops commented 3 years ago

Version

Paper Dashboard PRO - V1.3.1

Reproduction link

https://demos.creative-tim.com/paper-dashboard-pro/examples/forms/extended.html

Operating System

Windows 10

Device

PC

Browser & Version

Chrome, latest

Steps to reproduce

Open the 'extended.html' page in the examples of paper-dashboard-pro-v1.3.1 Watch the console in Chrome See error mentioned in title

What is expected?

No error should be exptected in the console when opening this example

What is actually happening?

Error is produced, saying perfectScrollbar is not a function


Solution

Did not find any solution yet, please help me find one.

Additional comments

Thanks for the nice work you did, I really like the template. But I need to get it to work without errors, so thank you in advance for your swift response and help with this. Best regards, Steffen

facundoruiz commented 3 years ago

Comenta el codigo del archivo paper-dashboard.js


// (function() {
//     isWindows = navigator.platform.indexOf('Win') > -1 ? true : false;

//     if (isWindows) {
//         // if we are on windows OS we activate the perfectScrollbar function
//         var ps = new PerfectScrollbar('.sidebar');
//         var ps1 = new PerfectScrollbar('.sidebar-wrapper');
//         var ps2 = new PerfectScrollbar('.main-panel');
//         $('html').addClass('perfect-scrollbar-on');

//     } else {
//         $('html').addClass('perfect-scrollbar-off');
//     }
// })();

y agrega esto luego del $(document).ready


    isWindows = navigator.platform.indexOf('Win') > -1 ? true : false;

    if (isWindows) {
        // if we are on windows OS we activate the perfectScrollbar function
        $('.sidebar').perfectScrollbar();
        $('.sidebar-wrapper').perfectScrollbar();
        $('.main-panel').perfectScrollbar();

        $('html').addClass('perfect-scrollbar-on');

    } else {
        $('html').addClass('perfect-scrollbar-off');
    }
sknoops commented 3 years ago

Hmmmm, does not seem to help @facundoruiz ... still same error.

image

facundoruiz commented 3 years ago

Hola, si tienes razón, mi culpa. yo estoy usando paper-dashboard-2 versión free https://www.creative-tim.com/product/paper-dashboard-2 y ahí se usa el plugin perfect-scrollbar v0.6.13 y la versión paper-dashboard-2-Pro plugin perfect-scrollbar v1.4.0 quizás cambiando de versión el plugin tu proyecto funcione!

PD: Fui a leer el https://demos.creative-tim.com/paper-dashboard-pro/assets/js/paper-dashboard.js busca la linea 123

if (isWindows) {
        $('.bootstrap-select .dropdown-menu .inner').perfectScrollbar();
      }

comenta o borrar esa esa linea Ahi creo que esta el problema en la version PRO.

sknoops commented 3 years ago

Muchas gracias @facundoruiz ! This is working. :-) So the creator of the dashboard should also use the old version, or they should make their javascript compatible with the v1.4.0. Best regards, Steffen

sknoops commented 3 years ago

And indeed, if I comment out the line you mentioned, but I found it on line 95, I can run the script with v1.4.0.

image