-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed container so that it would load extra messages if it detected that... #361
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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', => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When we bind to the "scroll" event, we have to make sure a scroll bar is actually present or it will never trigger. In the case of #358, the user had a vertical monitor which didn't allow for a scroll bar to appear. Thus, they couldn't scroll to trigger new messages. |
||
if $container.scrollTop() <= 100 && !@loading_new_messages | ||
@loading_new_messages = true | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,6 @@ $(document).ready -> | |
$(this).closest('.nav').addClass('search-focus') | ||
.on 'blur', -> | ||
$(this).closest('.nav').removeClass('search-focus') | ||
|
||
$.fn.hasScrollBar = -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A method that builds on a jQuery selector for ease of use. Not...really sure where to put this, so I put it in layout, but perhaps it should go somewhere different? |
||
(if @get(0) then @get(0).scrollHeight > @innerHeight() else false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's check if the $container object has a scroll bar. if it does not, load more messages until it does.