# Slideshow

Create a responsive image or video slideshow with stunning transition effects, fullscreen mode and overlays.

## Usage

To create a slideshow, just add the `.uk-slideshow` class to a `<ul>` element and place your images inside the list items. In order to load the necessary JavaScript, you also need to add the `data-uk-slideshow` attribute.

### Example

Note To activate autoplay, just add the `{autoplay:true}` option to the data attribute.

### Markup

    <ul class="uk-slideshow" data-uk-slideshow="{autoplay:true}">
        <li><img src="" width="" height="" alt=""></li>
    </ul>

## Navigations

To navigate through your slides, just use the `data-uk-slideshow-item` attribute. To target the slides, you need to set the data attribute of every nav item to the number of the respective slideshow item. The elements with the `data-uk-slideshow-item` attribute need to be inside the `data-uk-slideshow` container.

### Markup

    <div data-uk-slideshow>
        <ul class="uk-slideshow">
            <li></li>
            <li></li>
        </ul>
        <ul>
            <li data-uk-slideshow-item="0"><a href="">...</a></li>
            <li data-uk-slideshow-item="1"><a href="">...</a></li>
        </ul>
    </div>

Setting the attribute to `next` and `previous` will switch to the adjacent slides.

### Markup

    <div data-uk-slideshow>
        <ul class="uk-slideshow">
            <li></li>
            <li></li>
        </ul>
        <a href="" data-uk-slideshow-item="previous"></a>
        <a href="" data-uk-slideshow-item="next"></a>
    </div>

### Slidenav and Dotnav

The flexibility of the Slideshow component enables you to use any of the other UIkit components to navigate through items. For example the Slidenav and Dotnav can be used to style the slideshow navigations as you can see below.

#### Example

- Item 1
- Item 2
- Item 3

#### Markup

    <div class="uk-slidenav-position" data-uk-slideshow>
        <ul class="uk-slideshow">
            <li></li>
            <li></li>
        </ul>
        <a href="" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous" data-uk-slideshow-item="previous"></a>
        <a href="" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next" data-uk-slideshow-item="next"></a>
        <ul class="uk-dotnav uk-dotnav-contrast uk-position-bottom uk-flex-center">
            <li data-uk-slideshow-item="0"><a href=""></a></li>
            <li data-uk-slideshow-item="1"><a href=""></a></li>
        </ul>
    </div>

## Transitions

The Slideshow component allows you to add different animations to items when switching between them. All you need to do is add the `animation` parameter to the data-attribute and define the animation that you want to apply. Check the table below for an overview of the animations provided.

Class | Description
--- | ---
`fade` | The item fades in.
`scroll` | The items scroll in.
`scale` | The items scale up on out.
`swipe` | The items swipe in and out.

To apply these more advanced transitions, the `slideshow-fx.js` file needs to be included in the document head.

Class | Description
--- | ---
`slice-down` | The items slide down in slices.
`slice-up` | The items slide up in slices.
`slice-up-down` | The sliced items slide in alterning directions.
`fold` | The items are folded in.
`puzzle` | The items are divided in squares that randomly fade in.
`boxes` | The items are divided in squares that scale in diagonally from the top left corner.
`boxes-reverse` | The items are divided in squares that scale in diagonally from the bottom right corner.
`random-fx` | Different animations are applied randomly.

### Example

- ### Scroll

- ### Scale

- ### Swipe

- ### Slice Down

- ### Slice Up

- ### Slice Up Down

- ### Fold

- ### Puzzle

- ### Boxes

- ### Boxes Reverse

### Markup

    <ul class="uk-slideshow" data-uk-slideshow="{animation: 'random-fx'}">...</ul>

## Ken Burns effect

The Ken Burns effect can also be applied to slideshow items. Just add the `{kenburns:true}` option to the data attribute. This effect can also be applied to videos.

### Example

### Markup

    <ul class="uk-slideshow" data-uk-slideshow="{kenburns:true}">...</ul>

Custom animation duration:

    <ul class="uk-slideshow" data-uk-slideshow="{kenburns:'30s'}">...</ul>

## Fullscreen slideshow

To create a fullscreen slideshow that stretches to fill the entire viewport, just add the `.uk-slideshow-fullscreen` class.

#### Markup

    <ul class="uk-slideshow uk-slideshow-fullscreen" data-uk-slideshow>...</ul>

## Overlays

You can also enhance slideshows with different overlays. Just add the `.uk-overlay-panel` to a `<div>` element inside the list item. Also add `.uk-overlay-background` and `.uk-overlay-fade` to show a background and a transition. To toggle the overlay once a slide becomes active add the `.uk-overlay-active` to the list container. For more options, check out the Overlay component.

### Example

- ### Overlay

  Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
  sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.

- ### Overlay Top

  Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.

- ### Overlay Bottom

  Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.

- ### Overlay Left

  Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.

- ### Overlay Right

  Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.

### Markup

    <ul class="uk-slideshow uk-overlay-active" data-uk-slideshow>
        <li>
            <img src="" width="" height="" alt="">
            <div class="uk-overlay-panel uk-overlay-background uk-overlay-fade">...</div>
        </li>
    </ul>

## Video

UIkit allows you to present both video elements and Iframes within a slideshow.

### Example

### Markup

    <!-- This is a slideshow with a video element -->
    <ul class="uk-slideshow">
        <li>
            <video width="" height="" autoplay loop muted controls>
                <source src="" type="">
            </video>
        </li>
    </ul>

    <!-- This is a slideshow with an Iframe -->
    <ul class="uk-slideshow">
        <li>
            <iframe src="" width="" height="" frameborder="0" allowfullscreen></iframe>
        </li>
    </ul>

## Content

You can basically insert any content, like text or an entire grid as slideshow items.

### Example

- ### Headline 1

  Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.

- ### Headline 2

  Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.

### Init element manually

    var slideshow = UIkit.slideshow(element, { /* options */ });

## JavaScript Options

Option | Default | Description
--- | --- | ---
`animation` | 'fade' | Defines the preferred transition between items.
`duration` | 500 | Defines the transition duration.
`height` | 'auto' | Defines the slideshow height.
`start` | 0 | Defines the first slideshow item to be displayed.
`autoplay` | false | Defines whether or not the slideshow items should switch automatically.
`pauseOnHover` | true | Pause autoplay when hovering a slideshow.
`autoplayInterval` | 7000 | Defines the timespan between switching slideshow items.
`videoautoplay` | true | Defines whether or not a video starts automatically.
`videomute` | true | Defines whether or not a video is muted.
`kenburns` | false | Defines whether or not the Ken Burns effect is active. If `kenburns` is a numeric value, it will be used as the animation duration.
`kenburnsanimations` | 'uk-animation-middle-left', 'uk-animation-top-right', 'uk-animation-bottom-left', 'uk-animation-top-center', 'uk-animation-bottom-right' | Animation series.
`slices` | 15 | Defines the number of slices, if a "Slice" transition is set.

### Events

Name | Parameter | Description
--- | --- | ---
`show.uk.slideshow` | event, next slide, current slide | On showing a new slide (after animation is finished)
`beforeshow.uk.slideshow` | event, next slide, current slide | Before showing a new slide (before animation is finished)