vigour-carousel

1.2.1 • Public • Published

carousel

js-standard-style npm version Build Status

An infinite carousel for usage with vigour-element.

how to use

npm i --save vigour-carousel

Add the carousel to your app as a component, define the $collection for it's items and add the data.

The carousel exposes .next() and .previous() methods.

setup

var e = require('vigour-element')
var carousel = require('vigour-carousel')
 
// define some data
var Observable = require('vigour-observable')
var Data = new Observable({
  inject: require('vigour-observable/lib/data'),
  Child: 'Constructor'
}).Constructor
 
// it expects a "focus" field (this will be used to store the current slide)
var carouselData = new Data({
  focus: 0,
  0:{},
  1:{},
  2:{},
  3:{}
})
 
// add carousel component to your app
var app = e({
  components: {
    carousel: carousel
  },
  DOM: document.body
})
 
// add your carousel
app.set({
  myCarousel: {
    type: 'carousel',
    items:{
      $collection: true
    }
  }
})
 
// add data to app
app.val = carouselData

Package Sidebar

Install

npm i vigour-carousel

Weekly Downloads

0

Version

1.2.1

License

MIT

Last publish

Collaborators

  • vigour-io