UNPKG

uikit

Version:

UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.

339 lines (291 loc) • 14 kB
<!DOCTYPE html> <html lang="en-gb" dir="ltr"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Lightbox - UIkit tests</title> <script src="js/test.js"></script> </head> <body> <div class="uk-container"> <h1>Lightbox</h1> <h2>Animations</h2> <div class="uk-margin"> <select id="js-animation-switcher" class="uk-select uk-form-width-small" aria-label="Animation switcher"> <option value="slide">Slide</option> <option value="fade">Fade</option> <option value="scale">Scale</option> </select> </div> <div id="js-lightbox-animation" class="uk-child-width-1-5@m" uk-grid uk-lightbox> <div> <a class="uk-inline uk-panel uk-link-muted uk-text-center" href="images/size1.jpg" caption="900x600" data-alt="The value for the image alt attribute"> <figure> <img src="images/photo.jpg" width="400" height="267" alt=""> <figcaption class="uk-margin-small-top">900x600</figcaption> </figure> </a> </div> <div> <a class="uk-inline uk-panel uk-link-muted uk-text-center" href="images/size2.jpg" caption="700x500"> <figure> <img src="images/photo.jpg" width="400" height="267" alt=""> <figcaption class="uk-margin-small-top">700x500</figcaption> </figure> </a> </div> <div> <a class="uk-inline uk-panel uk-link-muted uk-text-center" href="images/photo.jpg" caption="1800x1200"> <figure> <img src="images/photo.jpg" width="400" height="267" alt=""> <figcaption class="uk-margin-small-top">1800x1200</figcaption> </figure> </a> </div> <div> <a class="uk-inline uk-panel uk-link-muted uk-text-center" href="images/size-v.jpg" caption="1000x2000"> <figure> <img src="images/photo.jpg" width="400" height="267" alt=""> <figcaption class="uk-margin-small-top">1000x2000</figcaption> </figure> </a> </div> <div> <a class="uk-inline uk-panel uk-link-muted uk-text-center" href="images/size-h.jpg" caption="2000x500"> <figure> <img src="images/photo.jpg" width="400" height="267" alt=""> <figcaption class="uk-margin-small-top">2000x500</figcaption> </figure> </a> </div> </div> <h2>Content Sources</h2> <div class="uk-child-width-1-5@m" uk-grid uk-lightbox> <div> <a class="uk-inline uk-panel uk-link-muted uk-text-center" href="images/size1.jpg" caption="Image"> <figure> <img src="images/photo.jpg" width="400" height="267" alt=""> <figcaption class="uk-margin-small-top">Image</figcaption> </figure> </a> </div> <div> <a class="uk-inline uk-panel uk-link-muted uk-text-center" href="https://yootheme.com/site/images/media/yootheme-pro.mp4" caption="Video" poster="images/photo.jpg"> <figure> <img src="images/photo.jpg" width="400" height="267" alt=""> <figcaption class="uk-margin-small-top">Video</figcaption> </figure> </a> </div> <div> <a class="uk-inline uk-panel uk-link-muted uk-text-center" href="https://www.youtube-nocookie.com/watch?v=c2pz2mlSfXA" caption="YouTube"> <figure> <img src="images/photo.jpg" width="400" height="267" alt=""> <figcaption class="uk-margin-small-top">YouTube</figcaption> </figure> </a> </div> <div> <a class="uk-inline uk-panel uk-link-muted uk-text-center" href="https://vimeo.com/1084537" caption="Vimeo"> <figure> <img src="images/photo.jpg" width="400" height="267" alt=""> <figcaption class="uk-margin-small-top">Vimeo</figcaption> </figure> </a> </div> <div> <a class="uk-inline uk-panel uk-link-muted uk-text-center" href="https://google.com/maps/embed?pb=!1m18!1m12!1m3!1d4740.819266853735!2d9.99008871708242!3d53.550454675412404!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x3f9d24afe84a0263!2sRathaus!5e0!3m2!1sde!2sde!4v1499675200938" caption="Iframe" type="iframe"> <figure> <img src="images/photo.jpg" width="400" height="267" alt=""> <figcaption class="uk-margin-small-top">Iframe</figcaption> </figure> </a> </div> </div> <h2>Dynamic lightbox</h2> <button id="js-lightbox" class="uk-button uk-button-default" type="button">Dynamic lightbox</button> <h2>JavaScript Options</h2> <h3>Lightbox</h3> <div class="uk-overflow-auto"> <table class="uk-table uk-table-striped"> <thead> <tr> <th>Option</th> <th>Value</th> <th>Default</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>animation</code></td> <td>String</td> <td>slide</td> <td>The animation to use. (fade, slide, scale)</td> </tr> <tr> <td><code>autoplay</code></td> <td>Boolean</td> <td>0</td> <td>Starts autoplaying the lightbox.</td> </tr> <tr> <td><code>autoplay-interval</code></td> <td>Number</td> <td>0</td> <td>The delay between switching slides in autoplay mode.</td> </tr> <tr> <td><code>pause-on-hover</code></td> <td>Boolean</td> <td>0</td> <td>Pause autoplay mode on hover.</td> </tr> <tr> <td><code>video-autoplay</code></td> <td>Boolean</td> <td>false</td> <td>Lets videos autoplay.</td> </tr> <tr> <td><code>toggle</code></td> <td>CSS selector</td> <td>a</td> <td>Toggle selector - triggers the lightbox.</td> </tr> </tbody> </table> </div> <h3>Lightbox Panel</h3> <div class="uk-overflow-auto"> <table class="uk-table uk-table-striped"> <thead> <tr> <th>Option</th> <th>Value</th> <th>Default</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>animation</code></td> <td>String</td> <td>slide</td> <td>The animation to use. (slide, fade, scale)</td> </tr> <tr> <td><code>autoplay</code></td> <td>Boolean</td> <td>false</td> <td>Starts autoplaying the lightbox.</td> </tr> <tr> <td><code>autoplay-interval</code></td> <td>Number</td> <td>7000</td> <td>The delay between switching slides in autoplay mode.</td> </tr> <tr> <td><code>video-autoplay</code></td> <td>Boolean</td> <td>false</td> <td>Lightbox videos autoplay.</td> </tr> <tr> <td><code>velocity</code></td> <td>Number</td> <td>2</td> <td>The animation velocity (pixel/ms).</td> </tr> <tr> <td><code>index</code></td> <td>Number</td> <td>0</td> <td>The initial item to show. (zero based)</td> </tr> <tr> <td><code>preload</code></td> <td>Number</td> <td>1</td> <td>The number of items to preload. (left and right of the currently active item)</td> </tr> <tr> <td><code>items</code></td> <td>Array</td> <td>[]</td> <td>An array of items to display. ([{source: 'images/size1.jpg', caption: '900x600'}])</td> </tr> <tr> <td><code>template</code></td> <td>String</td> <td></td> <td>The template string.</td> </tr> <tr> <td><code>delay-controls</code></td> <td>Number</td> <td>3000</td> <td>Delay time before controls fade out in ms.</td> </tr> <tr> <td><code>i18n</code></td> <td>Object</td> <td>null</td> <td>Override default translation texts.</td> </tr> </tbody> </table> </div> <h2>i18n</h2> <div class="uk-overflow-auto"> <table class="uk-table uk-table-striped"> <thead> <tr> <th>Key</th> <th>Default</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>next</code></td> <td>Next Slide</td> <td><code>aria-label</code> for next slide button.</td> </tr> <tr> <td><code>previous</code></td> <td>Previous Slide</td> <td><code>aria-label</code> for previous slide button.</td> </tr> <tr> <td><code>slideLabel</code></td> <td>%s of %s</td> <td><code>aria-label</code> for slide.</td> </tr> <tr> <td><code>close</code></td> <td>Close</td> <td><code>aria-label</code> for close button.</td> </tr> </tbody> </table> </div> </div> <script> const {$, attr, on } = UIkit.util; on('#js-animation-switcher', 'change', (e) => attr($('#js-lightbox-animation'), 'animation', e.target.value) ); on('#js-lightbox', 'click', (e) => { e.preventDefault(); UIkit.lightboxPanel({ items: [ {source: 'images/size1.jpg', caption: '900x600'}, {source: 'images/size2.jpg', caption: '700x500'}, ] }).show(); }); </script> </body> </html>