Skip to content

Commit

Permalink
Merge pull request #361 from scouttyg/no-scrollbar-message-fix
Browse files Browse the repository at this point in the history
Fixed container so that it would load extra messages if it detected that...
  • Loading branch information
Tony Guntharp committed May 15, 2014
2 parents a32900d + b227c8a commit 7a6fee7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/assets/javascripts/backbone/views/channel_pane.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions app/assets/javascripts/layout.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 7a6fee7

Please sign in to comment.