From 1b62ed8d412331693c1d02788134a61eb64348eb Mon Sep 17 00:00:00 2001 From: Peter Krautzberger Date: Thu, 31 Mar 2016 10:00:44 +0200 Subject: [PATCH] [content_panel_view] simplify scrolling to node fixes #157 --- reader/panels/content/content_panel_view.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/reader/panels/content/content_panel_view.js b/reader/panels/content/content_panel_view.js index 65a405a..7877486 100644 --- a/reader/panels/content/content_panel_view.js +++ b/reader/panels/content/content_panel_view.js @@ -59,8 +59,7 @@ ContentPanelView.Prototype = function() { this.onTocItemSelected = function(nodeId) { var n = this.findNodeView(nodeId); if (n) { - var topOffset = $(n).position().top+CORRECTION; - this.surface.$el.scrollTop(topOffset); + n.scrollIntoView(); } }; @@ -136,4 +135,4 @@ ContentPanelView.Prototype.prototype = ContainerPanelView.prototype; ContentPanelView.prototype = new ContentPanelView.Prototype(); ContentPanelView.prototype.constructor = ContentPanelView; -module.exports = ContentPanelView; \ No newline at end of file +module.exports = ContentPanelView;