spotlight icon indicating copy to clipboard operation
spotlight copied to clipboard

Using play with the api

Open ddrury opened this issue 3 years ago • 0 comments

Firstly , I've just discovered Spotlight - congratulations it's a nice small project, however I've hit a problem I can't solve. Here's the relevant bit of my code

  /**
   *
   * @param {HTMLElement} current
   *
   * @return {void}
   */
  const openLightbox = (current) => {
    Spotlight.show(collection, {
      index: collection.findIndex((el) => el.id === current.dataset.id) + 1,
      autohide: false,
      autoplay: false,
      play: true,
      download: canDownload,
      onchange: function (index, options) {
        // Support HTML in description
        if (options.description !== '') {
          const description = document.querySelector('#spotlight .spl-description');
          description.innerHTML = decodeURIComponent(options.description);
        }
      }
    });
  };

With play & autoplay set as above, when clicking on the play control, the slide change only runs once. Stopping play and restarting it again only runs for one slide change. If Autoplay is set to true then the slideshow runs properly.

In addition to the above, setting play to a number (any number) doesn't seem to have any effect.

ddrury avatar May 26 '21 13:05 ddrury