项目作者: bekzod

项目描述 :
Ember Addon
高级语言: JavaScript
项目地址: git://github.com/bekzod/ember-active-scroll-list.git
创建时间: 2015-12-23T17:01:28Z
项目社区:https://github.com/bekzod/ember-active-scroll-list

开源协议:MIT License

下载


ember-active-scroll-list

Ember Addon helps to keep active item of list visible in viewport

DEMO

Usage

  1. {{#active-scroll-list tolerance=0 scrollTimeout=2000 activeIndex=activeIndex class='list'}}
  2. {{#each items as |item index|}}
  3. <div class="item {{if (eq index activeIndex) 'active'}}">{{item}}</div>
  4. {{/each}}
  5. {{/active-scroll-list}}

can be also be extended as mixin

  1. import Ember from 'ember';
  2. import ActiveScrollListMixin from 'ember-active-scroll-list';
  3. export default Ember.Component.extend(ActiveScrollListMixin, {
  4. ...
  5. });

Options

  • activeIndex
    Index of element which needs to be visible on the list

  • tolerance
    How much top and bottom edges should be offset when determining overflow

  • scrollTimeout
    Timeout for when autoscroll is activated

Installation

You can install either with ember install:

  1. ember install ember-active-scroll-list