Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Webpack] - niceScroll is not a function #829

Open
epeliberty opened this issue May 4, 2021 · 0 comments
Open

[Webpack] - niceScroll is not a function #829

epeliberty opened this issue May 4, 2021 · 0 comments

Comments

@epeliberty
Copy link

Hello,

I tried to use jquery.nicescroll with webpack 4.43 but i have this error :

jQuery.Deferred exception: $domElts.faqBox.niceScroll is not a function TypeError: $domElts.faqBox.niceScroll is not a function
    at HTMLDocument.<anonymous> 

My code is :

import '../../../css/sites/customize/main.scss';

const Customize = () => {
  const $domElts = {
    faqBox: $('.faq-list .faq-list-questions-content')
  };

  const initEvents = () => {
    if ($domElts.faqBox.length > 0) {
       $(() => {
    
         $domElts.faqBox.niceScroll({
           cursorcolor: "#31b7bc",
           cursorwidth: "7px",
           zindex: -1,
         });
       })
    }
  };

  return {
    init: () => {
      initEvents();
    },
  };
};

$(() =>{
  Customize().init();
});

On my webpack.config.js, I have add this :

.autoProvidejQuery()

but it's doesn't work ...

Thank you in advance for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant