I'm using this javascript to create a 'zaccordion' on my Drupal 8 site. However, it's not working. My 'slideshow' just appears as a bulleted list of images.
Here's what I've got so far:
A block on my page with the following content:
<ul id="slideshow">
<li>image</li>
<li>image</li>
</ul>
I've also got the required javascript files from the download link (above) in themename/js. I've also got my own instantiation of the zaccordion in another js file in that same folder and it targets #slideshow like so:
(function ($) {
$(document).ready(function() {
$("#slideshow").zAccordion({
settings here
});
});
})(jQuery);
Then, in my libraries.yml file I have this:
zaccordion:
header: true
version: 1.x
js:
js/jquery.zaccordion.min.js: { }
js/jquery.zaccordion.js: { }
js/zaccordionUsage.js: { }
dependencies:
- core/jquery
I put that in the 'header' because it wasn't working in the footer. I can confirm the files are being pulled into the page because I see links to the scripts in the <head>
of the html.
Finally, I have the javascript library being placed into the page with this call near the top of page--front.html.twig:
{{ attach_library('themename/zaccordion') }}
Are all these settings correct?
I have this same slideshow functionality working easily on a Jekyll site I created so I assume it's something to do with the way my block is trying to reference the javascript files or something.
Note: yes, I have JavaScript aggregation unchecked (Performance > Aggregate Javascript)
js/jquery.zaccordion.min.js: { }
the minified version. There is no need to load the unminified versionjs/jquery.zaccordion.js: { }
you're basically loading the same script twice. The unminited version is for development use, since it's easy to read. The minified version is for production use, as it removes all the white spaces and compacts the code making the file size smaller.