From bb86373ab905f879cdafa04375346ca44511a8cc Mon Sep 17 00:00:00 2001 From: Shea Dawson Date: Mon, 19 Aug 2013 11:18:37 +1000 Subject: [PATCH] CMS tree pane to scroll to the page being edited. Fixes #827 --- javascript/CMSMain.Tree.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/javascript/CMSMain.Tree.js b/javascript/CMSMain.Tree.js index e866f440..5c3d2bc5 100644 --- a/javascript/CMSMain.Tree.js +++ b/javascript/CMSMain.Tree.js @@ -110,6 +110,18 @@ return config; } }); + + // Scroll tree down to context of the current page + $('.cms-tree a.jstree-clicked').entwine({ + onmatch: function(){ + var self = this, + panel = self.parents('.cms-panel-content'); + + panel.animate({ + scrollTop: self.offset().top - (panel.height() / 2) + }, 'slow'); + } + }); }); }(jQuery));