Jquery in Drupal 8 and creating your own paragraph slideshow component

Submitted by barnettech on Sat, 08/17/2019 - 01:42


(function ($, Drupal) {
Drupal.behaviors.myModuleBehavior = {
attach: function (context, settings) {
$(window).once().on('load scroll', function () {
// ...
$('.your-class').slick({
dots: true,
infinite: true,
speed: 500,
fade: true,
cssEase: 'linear'
});
});
}
};
})(jQuery, Drupal);


foobar:
js:
js/foobar.js: {}
dependencies:
- core/jquery
- core/jquery.once

in the twig file paragraph--slideshow1.html.twig:

{% block paragraph %}

{% block content %}

{{content.field_paragraph_slideshow_image.0}}
{{content.field_paragraph_slideshow_image.1}}

{# {{ content.field_slideshow1_text1 }} #}
{% endblock %}

{% endblock paragraph %}