Don't scroll to story if it isn't visible.

This commit is contained in:
Samuel Clay 2016-11-18 17:14:08 -08:00
parent b576e274a2
commit 7b3a88b0a4

View file

@ -186,7 +186,7 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
scroll_to_selected_story: function(story, options) {
options = options || {};
if (!story) story = NEWSBLUR.reader.active_story;
if (!story || !story.story_view || !story.story_view.$el.length) return;
if (!story || !story.story_view) return;
var $story = story.story_view.$el;
if (NEWSBLUR.assets.preference('feed_view_single_story')) {
@ -201,6 +201,11 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
return;
}
if (!options.scroll_to_top && !$story.closest(NEWSBLUR.reader.$s.$feed_scroll).length) {
console.log(['Story not visible, not scrolling', $story]);
return;
}
clearTimeout(NEWSBLUR.reader.locks.scrolling);
NEWSBLUR.reader.flags.scrolling_by_selecting_story_title = true;
var scroll_to = options.scroll_to_top ? 0 : $story;