用法1 - 整屏滑动

slider item 1
slider item 2
slider item 3
var slider1 = new NiceSlider('#slider1', {unlimit: false})

用法2 - 偏移滑动

slider item 1
slider item 2
slider item 3
var w = $('.offset').width()
var slider2 = new NiceSlider('#slider2', {unlimit: false, offset: w * 0.2})

用法3 - 无缝循环

slider item 1
slider item 2
slider item 3
var w = $('.unlimit').width()
var slider3 = new NiceSlider('#slider3', {offset: w * 0.2})

用法4 - 自动播放

slider item 1
slider item 2
slider item 3
var slider4 = new NiceSlider('#slider4', {autoPlay: true, duration: 3000, animation: 'linear'})

用法5 - 标签页功能

slider item 1
slider item 2
slider item 3
var slider5 = new NiceSlider('#slider5', {
  noAnimate: true, 
  drag: false, 
  indexFormat: function (i) {
    return '标签' + (i + 1)
  }
})

用法6 - 下拉刷新

loading...
slider item 1
slider item 2
slider item 3
var loading = $('.refresh .loading')
var slider6 = new NiceSlider('#slider6', {
  unlimit: false, 
  ctrlBtn: false, 
  indexBtn: false, 
  dir: 'v',
  onChange: function () {
    var idx = this.getIndex()
    if (idx === this.stepLength - 1) {
      loading.show()
      this.fragmentDom.append('
slider item ' + (this.stepLength + 1) + '
') this.refresh() setTimeout(function () { loading.hide() }, 1000) } } })

用法7 - 嵌套滑动

左右滑动
上下滑动 1
上下滑动 2
上下滑动 3
上下滑动
左右滑动 1
左右滑动 2
左右滑动 3
左右滑动 1
左右滑动 2
左右滑动 3
var slider7 = new NiceSlider('#slider7', {ctrlBtn: false, indexBtn: false, unlimit: false})
var slider8 = new NiceSlider('#slider8', {dir: 'v', ctrlBtn: false, indexBtn: false, unlimit: false})
var slider9 = new NiceSlider('#slider9', {ctrlBtn: false, indexBtn: false, unlimit: false})
var slider10 = new NiceSlider('#slider10', {dir: 'v', ctrlBtn: false, indexBtn: false, unlimit: false})
var slider11 = new NiceSlider('#slider11', {ctrlBtn: false, indexBtn: false, unlimit: false})

用法8 - 滑动锁定

slider12: unlock
左右滑动 1
上下滑动 1
上下滑动 2
上下滑动 3
var slider12 = new NiceSlider('#slider12', {ctrlBtn: false, indexBtn: false, unlimit: false,
  onChange: function () {
    var idx = this.getIndex()
    if (idx === 1) {
      this.lock()
      $('#s12').html('locked')
    }
  }
})
var slider13 = new NiceSlider('#slider13', {dir: 'v', ctrlBtn: false, indexBtn: false, unlimit: false,
  onChange: function () {
    var idx = this.getIndex()
    if (idx === 2) {
      slider12.unlock()
      $('#s12').html('unlock')
    }
  }
})

用法9 - Carousel

var slider14 = new NiceSlider('#slider14', {unlimit: false, unit: 0})
目前暂未处理无限滚动的 Carousel 效果,既即使设置了 unlimit:true 也会被重置为 false

查看更多请前往README