Hi,
I'm currently testing out the 8.x-2.x branch (which I couldn't select here), but I have the same problem on the other 8.x branches.
Problem description
I stumbled into this issue while enabling the 'Statistics' module. The table node_counter did not increase because there was no AJAX call to statistics.php. That call was never launched due to following Javascript (JS) error (being caused by the Zircon theme)
js_Wsb4D8DIo1NfhHje4X4ZGJpzg9cX7Ecw98j0-z-7PpA.js:8379 Uncaught TypeError: $ is not a function
at js_Wsb4D8DIo1NfhHje4X4ZGJpzg9cX7Ecw98j0-z-7PpA.js:8379
The JS is ofcourse aggregated, but it boils down to assets/includes/slick/js/scripts.js:
$(document).ready(function() { <---- ERROR
$('.single-item').slick({
.....
Solution
According to some Drupal 8 documentation pages, I've noticed you have to wrap your JS code in the following template:
(function ($, Drupal) {
'use strict';
# YOUR CODE HERE
})(jQuery, Drupal);
So I changed the file according to the needs, and the JS error was gone. Even better, my AJAX call to statistics (which has nothing to do with it :-)) started working as well!
Comment | File | Size | Author |
---|---|---|---|
slick_javascript_error.patch | 479 bytes | Jochus |
Comments
Comment #2
tgoeg CreditAttribution: tgoeg commentedDoes your zircon.libraries.yml really still load this file?
The latest version here on drupal.org (https://ftp.drupal.org/files/projects/zircon-8.x-1.0-rc1.tar.gz) does not load the file in the zircon.libraries.yml although it is included in the tarball.
The current WeebPal one (http://weebpal.com/sites/default/files/packages/zircon_d8.zip) does not even include the file anymore.
I'll mark this as fixed.