henrygd / bigger-picture

JavaScript lightbox gallery for images, video, audio, iframes, html. Zoomable, responsive, accessible, lightweight.
https://biggerpicture.henrygd.me
MIT License
231 stars 17 forks source link

Option to set HTML5 video attributes like "autoplay", "loop" or "muted" #21

Closed FluffyDiscord closed 1 year ago

FluffyDiscord commented 1 year ago

Title

henrygd commented 1 year ago

You can use onOpen or onUpdate to set video properties or modify attributes with setAttribute or removeAttribute:

bp.open({
  onOpen(container, activeItem) {
    const video = container.querySelector('video')
    video.autoplay = false
    video.loop = false
    video.muted = true
  },
})