Scrolling to comments in List view when clicking on Comments in story title.

This commit is contained in:
Samuel Clay 2015-07-22 18:02:43 -07:00
parent 487b79674c
commit e5fb27eda2
2 changed files with 14 additions and 4 deletions

View file

@ -755,10 +755,17 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
},
scroll_to_comments: function() {
NEWSBLUR.app.story_list.scroll_to_selected_story(this.model, {
scroll_to_comments: true,
scroll_offset: -50
});
if (_.contains(['list', 'grid'], NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout'))) {
NEWSBLUR.app.story_titles.scroll_to_selected_story(this.model, {
scroll_to_comments: true,
scroll_offset: -50
});
} else {
NEWSBLUR.app.story_list.scroll_to_selected_story(this.model, {
scroll_to_comments: true,
scroll_offset: -50
});
}
}

View file

@ -280,6 +280,9 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
_.contains(['list', 'grid'], NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout'))) {
var container_offset = NEWSBLUR.reader.$s.$story_titles.position().top;
var scroll = story_title_view.$el.find('.NB-story-title').position().top;
if (options.scroll_to_comments) {
scroll = story_title_view.$el.find('.NB-feed-story-comments').position().top;
}
var container = NEWSBLUR.reader.$s.$story_titles.scrollTop();
var height = NEWSBLUR.reader.$s.$story_titles.outerHeight();
var position = scroll+container-height/5;