1.2.1 • Published 10 years ago
vigour-carousel v1.2.1
carousel
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