DataFormsJS <image-gallery> Web Component

Image Gallery

Features

GitHub Full Source Code

Example Usage and Code

                    <!--
Include component on page
-->
<script type="module" src="dataformsjs/js/web-components/image-gallery.min.js">
</script>

<!--
    Include an <img> within the <image-gallery> and
    specify [image] and optional [title] attribute on the <image-gallery>
    If [title] is not included [alt] from the <img> can be used.
-->
<image-gallery image="${image}">
    <img src="${thumbnail}" alt="${title}" />
</image-gallery>

<!--
    Or simply include a background image on the <image-gallery> element.
    This example uses a custom loading message and timeout.
-->
<image-gallery
    image="${image}"
    style="background-image: url('${thumbnail}');"
    title="${title}"
    loading-text="Carregando..."
    loading-timeout="1000">
</image-gallery>

<!--
    Supports next-gen image formats AVIF and WebP by using
    optional attributes [image-avif] and [image-webp].
    When using next-gen image formats a default/fallback [image]
    must be included similar to how the HTML <picture> element works.
-->
<image-gallery
    image="${image}"
    image-avif="${image_avif}"
    image-webp="${image_webp}">
        <img src="${thumbnail}" alt="${title}" />
</image-gallery>

<!--
To override default styles use `!important` and specify the style
attributes to override in any style sheet on the page or define your
own style sheet before the component runs using id `image-gallery-css`.
-->
<style>
.image-gallery-overlay { background-color: black !important; }
.image-gallery-overlay { background-color: rgba(0,0,0,.7) !important; }

.image-gallery-overlay .btn-previous,
.image-gallery-overlay .btn-next { background-color: blue !important; }
</style>
<style id="image-gallery-css">...</style>
<link rel="stylesheet" id="image-gallery-css" href="css/image-gallery.css">
                
Loading Photos...

Error loading photos