Sha256: 303f14f56e7ac895a701e1e3807e1f7cbbdaebee4edac7876dd13d9225b9e428

Contents?: true

Size: 827 Bytes

Versions: 2

Compression:

Stored size: 827 Bytes

Contents

# -----------------------------------------------------------------------------
# LIST SCROLL
# todo:
#  - trigger onScroll event only when scrolling down
# -----------------------------------------------------------------------------
@_listBindPagination = (listEl) ->
  $container = listEl.$el
  $list      = listEl.$items
  arrayStore = listEl.config.arrayStore

  $list.scroll (e) =>
    if ! arrayStore.dataFetchLock
      $listChildren        = $list.children()
      listChildrenCount    = $listChildren.length
      listFirstChildHeight = $listChildren.first().outerHeight()
      listHeight           = listChildrenCount * listFirstChildHeight
      viewHeight           = $container.height()

      if listHeight < (viewHeight + e.target.scrollTop + 100)
        listEl._show_spinner()
        arrayStore.load()





Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chr-0.2.1 app/assets/javascripts/chr/core/list-pagination.coffee
chr-0.2.0 app/assets/javascripts/chr/core/list-pagination.coffee