1.5.0 • Published 2 years ago

vue2-ssr-carousel-rtl v1.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

vue-ssr-carousel

A performance focused Vue carousel designed for SSR/SSG environments.

Check out the demo: https://vue-ssr-carousel.netlify.app.

Install

yarn add vue-ssr-carousel

Default

import SsrCarousel from 'vue-ssr-carousel'
import ssrCarouselCss from 'vue-ssr-carousel/index.css'
Vue.component 'ssr-carousel', SsrCarousel

Nuxt

// nuxt.config.js
export default {
  buildModules: [ 'vue-ssr-carousel/nuxt' ]
}

Usage

<ssr-carousel>
  <div class="slide">Slide 1</div>
  <div class="slide">Slide 2</div>
  <div class="slide">Slide 3</div>
</ssr-carousel>

For more examples, see the demo: https://vue-ssr-carousel.netlify.app.

API

Props

PropsDefaultDescription
slides-per-page1How many slides are shown per page.
gutter20The size of the space between slides. This can a number or any CSS resolvable string. See https://vue-ssr-carousel.netlify.app/gutters.
paginate-by-slidefalseWhen false, dragging the carousel or interacting with the arrows will advance a full page of slides at a time. When true, the carousel will come to a rest at each slide.
loopfalseBoolean to enable looping / infinite scroll. See https://vue-ssr-carousel.netlify.app/looping.
centerfalseRender the first slide in the middle of the carousel. Should only be used with odd numbers of slides-per-page. This results in the slides being rendered visually in a different order than the DOM which is an accessibility concern. See https://vue-ssr-carousel.netlify.app/looping.
peek0A width value for how far adjacent cards should peek into the carousel canvas. This can a number or any CSS resolvable string. See https://vue-ssr-carousel.netlify.app/peeking.
peek-left0Set peek value on just the left edge.
peek-right0Set peek value on just the right edge.
peek-gutterfalseSet peek value equal to gutter value.
featherfalseFades out the left and right edges using a CSS mask-image gradient. Set to true to use the default 20px value or as number or any CSS resolvable string to set an explicit width. This is designed to be used with peek properties. See https://vue-ssr-carousel.netlify.app/peeking.
overflow-visiblefalseDisables the overflow:hidden that wraps the slide track. You would do this if you want to handle that masking in an ancestor element. See https://vue-ssr-carousel.netlify.app/peeking.
show-arrowsfalseWhether to show back/forward arrows. See https://vue-ssr-carousel.netlify.app/ui.
show-dotsfalseWhether to show dot style pagination dots. See https://vue-ssr-carousel.netlify.app/ui.
responsive[]Adjust settings at breakpoints. See https://vue-ssr-carousel.netlify.app/responsive. Note, loop and paginate-by-slide cannot be set responsively.

Slots

SlotsDescription
defaultWhere your slides get injected.
back-arrowReplace the default back icon. Slot props:
disabled - True if at first page when not looping.
next-arrowReplace the default next icon. Slot props:
disabled - True if at last page when not looping.
dotReplace the default pagination dots. Slot props:
index - The page index that the dot represents.
disabled - True if dot represents current page.

Methods

MethodsDescription
next()Go forward a page or slide, depending on the paginate-by-slide prop
back()Go back a page or slide, depending on the paginate-by-slide prop
goto(index)Go to an index. If paginate-by-slide is false, this equates to a page offset. If true, this equates to a slide offset.

Events

See https://vue-ssr-carousel.netlify.app/events

EventsDescription
change({ index })Fired when the internal index counter changes
pressFired on mouse or touch down
releaseFired on mouse or touch up
drag:startFired on start of dragging
drag:endFired on end of dragging
tween:start({ index })Fired when the carousel starts tweening to it's final position
tween:end({ index })Fired when the carousel has finished tweening to it's destination.