0

New to Drupal 8.

I've created a demo theme. The .libraries.yml file is below:

global-styling-and-scripts:
 version: VERSION
 css:
  base:
   assets/css/font-awesome.css: {}
   assets/css/bootstrap.css: {}
   assets/css/slick.css: {}
   assets/css/bootstrap-datepicker.css: {}
   assets/css/jquery.fancybox.css: {}
   assets/css/theme-color/default-theme.css: {}
   assets/css/style.css: {}
  theme:
   '//fonts.googleapis.com/css?family=Tangerine': { type: external, minified: true }
   '//fonts.googleapis.com/css?family=Open+Sans': { type: external, minified: true }
   '//fonts.googleapis.com/css?family=Prata': { type: external, minified: true }
 js:
  assets/js/jquery.min.js: {}
  assets/js/bootstrap.js: {}
  assets/js/slick.js: {}
  assets/js/waypoints.js: {}
  assets/js/jquery.counterup.js: {}
  assets/js/bootstrap-datepicker.js: {}
  assets/js/jquery.mixitup.js: {}
  assets/js/jquery.fancybox.pack.js: {}
  assets/js/custom.js: {}
  dependencies:
   - core/drupalSettings
   - core/jquery
   - core/jquery.once

If I deleted all the .js from this file, I see no errors in the console however, the images, and slideshows etc are not properly rendering.

3

3 Answers 3

3

Perhaps your bootstrap requires an older version of jquery, see if you can override it with a version lower than 3 following the instructions from

How do I use a jQuery version different from the default one used by core?

3

You're loading 2 versions of jquery: assets/js/jquery.min.js: {} - core/jquery

That's most likely your issue. Try removing the assets/js/jquery.min.js entry and flushing your cache. That will mean you're just using Drupal's core jquery which hopefully your plugin should work fine with

1
  • Thanks. I did the same as you said. in the console, I see there is no such error for JS however, it shows another kind of error Uncaught Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3 Mar 28, 2019 at 11:36
0

This shouldn't be an issue in newer versions of Drupal but just in case anyone stumbles upon this like me: After @GiorgosK's answer I changed my

  once('drop-render', '.form-item-field-myfield-value-min', context).each(function () {
  });

to

  $(once('drop-render', '.form-item-field-myfield-value-min', context)).each(function () {
  });

and it worked beautifully.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.