Sha256: 02efbf8909a64db76d90eb2de7b836c4fdfcd8e17d3010a9b6ccca884330117f

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

$(() => {
  $(".orbit-previous").after(`<button class="control" aria-label="button-control">`);
  const plugin = $('.orbit').data("zfPlugin");

   $(document.body).on( "click", ".orbit-bullets > .control", function() {
    $(this).toggleClass("pause");

    if ($(this).hasClass("pause")) {
      plugin.options.autoPlay = false;
      plugin.$element.data('clickedOn', true);
      plugin.timer.pause();
    } else {
      plugin.$element.data('clickedOn', false);
      plugin.options.autoPlay = true;
      plugin.timer.restart();
    }
  });

  $("#slider-block .orbit-previous, #slider-block .orbit-next, #slider-block .orbit-bullets > button")
    .attr('tabindex', 0)
    .on('click.zf.orbit touchend.zf.orbit', function (e) {
      const plugin = $('.orbit').data("zfPlugin");
      plugin.options.autoPlay = false;
      plugin.$element.data('clickedOn', true);
      plugin.timer.pause();
    });

    $(".orbit").on("beforeslidechange.zf.orbit", function (event, currentSlide, newSlide) {
        if (currentSlide.find("video").length > 0){
            currentSlide.find("video")[0].pause();
        }
        if (newSlide.find("video").length > 0){
            newSlide.find("video")[0].play();
        }
    });
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-slider-0.0.1 app/packs/src/decidim/slider/orbit_slider.js