summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib/view/Scrollable.js
blob: d06ed590744c9655b55e916c3d619d4e19b0eec5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var ScrollableView = View.extend({
  
  events: {
    "load img": "deferRefresh",
  },

  deferScrollToTop: function(){
    setTimeout(this.scrollToTop.bind(this), 0)
  },
  
  refreshScroller: function(){
    this.scroller.refresh()
    clearTimeout( this.scrollerRefreshTimeout )
  },

  scrollerRefreshTimeout: null,
  deferRefresh: function(){
    clearTimeout( this.scrollerRefreshTimeout )
    this.scrollerRefreshTimeout = setTimeout(this.refreshScroller.bind(this))
  },
    
  scrollToTop: function(){
    this.scroller.refresh()
    app.collection.scroller.scrollTo(0, 0)
  },

})