Description

This is the main component of the slider and will be the view that display the images.

Component

The slider preloads all images to make transitions smooth, so depending on size and quantity of images can take a while to begin.

The component is build as a container, having a mask that renders and display the images. The mask contains the transition component and two FluxImages that are used to be shown before and after transitions.

In touchable screens you can slide right and left to show previous or next image. Will also display index if defined sliding up.

The component has the following attributes.

AttributeTypeRequiredDescription
optionsObjectfalseAn object containing the slider options
transitionsObjecttrueAn object defined with the wanted transitions
transitionOptionsObjectfalseThe options for each transition
pathstringfalseBase path of the images
imagesArrayfalseAn array with the images URL
captionsArrayfalseAn array with captions to be displayed on each image

Example:

<vue-flux
   :options="fluxOptions"
   :images="fluxImages"
   :transitions="fluxTransitions"
   :captions="fluxCaptions"
   ref="slider">
</vue-flux>

<button @click="$refs.slider.show('next')">NEXT</button>

Options

OptionTypeDefaultDescription
autoplayBooleanfalseAutoplay images when loaded
fullscreenBooleanfalseAllows the slider to be displayed in full screen
enableGesturesBooleanfalseDefine if in touchable screens should show control and index icons or use gestures
infiniteBooleantrueThe slider will start over when reaches the last image, otherwise will stop
bindKeysBooleanfalseBinds the arrow keys to show next or previous
delayInteger5000The time in ms that an image will be displayed before changing to next
autohideTimeInteger1500The time in ms that the controls and index button will stay until disappear. If set to 0 they will never disappear
widthstring100%Defines the slider width
heightstringautoDefines the slider height

Size

The slider size is defined the following way.

If width and height are passed in options, that size will prevail over all.

By default the width will be the parents width and height will be auto.

If the height is auto, it will check if the slider has a defined CSS with height, if not will check the parent, otherwise will calculate the height using the width as per 16:9 ratio.

Transitions

This is an object that will own the transitions to be used between images. The object is build using the transition name and its component.

The transitions will be run in the order defined and then will begin again from the first.

The transitions have a direction being 'right' by default and using 'left' when next image is previous so different transitions can be run depending on direction.

Slider will ignore any interaction while a transition is running.

Refer to Transitions to know more about included transitions.

Example:

import { VueFlux, Transitions } from 'vue-flux';

let fluxTransitions: {
   transitionFade: Transitions.transitionFade,
   transitionBook: Transitions.transitionBook,
   transitionBlocks2: Transitions.transitionBlocks2
}

Transition options

This is an object with the options that will overwrite the default of transitions.

Example:

let transitionOptions: {
   transitionFade: {
      totalDuration: 500,
      easing: 'ease'
   },
   transitionBlocks2d2: {
      rows: 5,
      cols: 5,
      tileDelay: 150
   }
}

Path

Is the base path of the images. For example if all the images are located in /img/slide/example you can set it and then in the images array just use the file names.

Images

The array containing the image URLs to be displayed.

If an image can not be loaded will be omitted displaying a console warning message.

Properties

This are the component properties that you can access programatically.

NameTypeDescription
configObjectSet of slider options
sizeObjectSize in pixels having width and height
loadedBooleanDetermines if the images have been loaded and slider is initialized
transitionObjectManages current and last transition
imagesLoadednumberNumber of images loaded
loadedBooleanIndicates when all the images have been preloaded
propertiesArrayArray of objects that have the images properties
touchableBooleanReturns if the screen is touchable
captionComponentThe caption component
controlsComponentThe controls component
indexComponentThe index component
paginationComponentThe pagination component
maskHTMLReferences the slider mask container where the images are displayed
sizePxObjectAn object having width and height in pixels with the 'px' unit
loadPctnumberPercentage of images already loaded
nextTransitionstringName of the next transition
directionstringBy default is 'right', and 'left' when next image is before the current

References

NameElementDescription
containerdivContainer of all the slider
maskdivWrapper having the transition and control images
transitioncomponentTransition component that runs to change image
image1FluxImageImage to be displayed before or after the transition
image2FluxImageImage to be displayed before or after the transition

Methods

MethodParametersDescription
currentImageImage component being displayed currently
nextImageImage component that will be displayed next
resizeCall to recalculate the sizes of the slider
inFullscreenReturns if slider is currently in full screen
requestFullscreenSets the slider in full screen
exitFullscreenLeaves the full screen mode
toggleFullscreenToggles full screen mode
playindexWill start displaying the images by the interval specified in config. The index is the image number to start with, and can also be 'previous' and 'next'
stopStops playing images and remains in the current
toggleAutoplayToggles auto play
getIndexindexWill return the position in the array given a number or a string ('next' or 'previous')
showindex, transitionDisplays the image specified by image index (or 'next' or 'previous') and using the specified transition. If no index specified will display next and if no transition specified will use the next defined in transitions