FIX: If the progress docked and you jumped to the top it could dissappear.

This commit is contained in:
Robin Ward 2013-07-04 17:35:20 -04:00
parent 2d821d1ff4
commit e58d09a463

View file

@ -255,7 +255,6 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
@method updatePosition
**/
updatePosition: function() {
this.processSeenPosts();
var offset = window.pageYOffset || $('html').scrollTop();
@ -277,7 +276,10 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
// Dock the counter if necessary
var $lastPost = $('article[data-post-id=' + topic.get('postStream.lastPostId') + "]");
var lastPostOffset = $lastPost.offset();
if (!lastPostOffset) { return; }
if (!lastPostOffset) {
this.set('controller.dockedCounter', false);
return;
}
this.set('controller.dockedCounter', (offset >= (lastPostOffset.top + $lastPost.height()) - $(window).height()));
},