Skip to content

Gallery

calebwaldorf edited this page Jul 23, 2018 · 10 revisions

A gallery directive can be used to insert an array of media elements into a containing figure. Custom JavaScript and CSS can be applied on a per-build basis to customize the look of the gallery, and can be used with third party tools to create carousels.

The example below assumes that there both the image and video assets exist in the appropriate build directories.

Input

::: gallery:my-gallery

:: item:one type:image source:my-image.jpg caption:"Image caption" ::

:: item:two type:video source:my-video caption:"Video caption" ::

::: exit:my-gallery

Output

<div class="figure__large figure__inline figure__fullbleed">
    <figure id="my-gallery">
        <div class="figure__items">
            <div class="gallery__item" data-gallery-item="one">
                <img data-image="my-image-jpg" src="../images/my-image.jpg" alt="my-image.jpg" />
                <div class="figcaption" data-caption="my-image-jpg">
                    <p class="small">Image caption</p>
                </div>
            </div>
        </div>

        <div class="figure__items">
            <div class="gallery__item" data-gallery-item="two">
                <section class="video">
                    <video data-video="my-video">
                        <source src="../media/my-video.mp4" type="video/mp4" />
                    </video>
                    <button data-media-controls="my-video" class="media__controls media__controls--play" />
                </section>
            </div>
        </div>
    </figure>
</div>
Clone this wiki locally