diff --git a/app/assets/javascripts/backbone/views/channel_pane.js.coffee b/app/assets/javascripts/backbone/views/channel_pane.js.coffee index a0add6f4..11e127e5 100644 --- a/app/assets/javascripts/backbone/views/channel_pane.js.coffee +++ b/app/assets/javascripts/backbone/views/channel_pane.js.coffee @@ -8,6 +8,10 @@ class Kandan.Views.ChannelPane extends Backbone.View # Flag to avoid pulling new messages when we already requested new messages from the server @loading_new_messages = false + if !$container.hasScrollBar() + @loading_new_messages = true; + @loadMoreActivities($container) + $container.bind 'scroll', => if $container.scrollTop() <= 100 && !@loading_new_messages @loading_new_messages = true diff --git a/app/assets/javascripts/layout.js.coffee b/app/assets/javascripts/layout.js.coffee index 4f8066a0..c4109e65 100644 --- a/app/assets/javascripts/layout.js.coffee +++ b/app/assets/javascripts/layout.js.coffee @@ -21,3 +21,6 @@ $(document).ready -> $(this).closest('.nav').addClass('search-focus') .on 'blur', -> $(this).closest('.nav').removeClass('search-focus') + + $.fn.hasScrollBar = -> + (if @get(0) then @get(0).scrollHeight > @innerHeight() else false)