Add spinner for long-loading message lists
This commit is contained in:
parent
992dfa5b20
commit
fbc73c0369
4 changed files with 41 additions and 2 deletions
|
@ -19,14 +19,18 @@
|
|||
|
||||
Whisper.MessageListView = Whisper.ListView.extend({
|
||||
tagName: 'ul',
|
||||
className: 'message-list',
|
||||
className: 'message-list loading',
|
||||
itemView: Whisper.MessageView,
|
||||
events: {
|
||||
'add': 'scrollToBottom',
|
||||
'add': 'onAdd',
|
||||
'update *': 'scrollToBottom',
|
||||
'scroll': 'measureScrollPosition',
|
||||
'reset-scroll': 'resetScrollPosition'
|
||||
},
|
||||
onAdd: function() {
|
||||
this.$el.removeClass('loading');
|
||||
this.scrollToBottom();
|
||||
},
|
||||
measureScrollPosition: function() {
|
||||
this.scrollPosition = this.$el.scrollTop() + this.$el.outerHeight();
|
||||
this.scrollHeight = this.el.scrollHeight;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue