call a function from a JS framework attached to the theme

by Tyler   Last Updated June 12, 2019 18:07 PM

I attached materialize to my library theme.

global-styling:
  version: VERSION
  css:
    base:
      materialize/css/materialize.min.css: {}
      css/style.css: {}
  js:
    materialize/js/materialize.min.js: { minified:true}
    js/layout.js: {}
  dependencies:
    - core/drupal
    - core/jquery

But in layout.js I run .sidenav() and it says it's undefined.

(function ($, Drupal) {
    $('.sidenav').sidenav();
 })(jQuery, Drupal);

I can't find how to properly call 3rd party js functions in my custom scripts.



Related Questions


Updated March 29, 2015 06:02 AM

Updated March 29, 2016 08:03 AM

Updated March 18, 2017 07:07 AM

Updated July 26, 2017 08:07 AM

Updated August 04, 2017 22:07 PM