summaryrefslogtreecommitdiff
path: root/program/js
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2013-02-10 17:06:08 +0100
committerThomas Bruederli <thomas@roundcube.net>2013-02-10 17:06:08 +0100
commitd6185f3c91c2eff1befc14d61443de8a28ac92f5 (patch)
tree1baeccb7b9187a8c282f2886e9cea1b77b5dad59 /program/js
parent1887286fe99bd04aaddf5570972029843538a786 (diff)
Only scroll tree list of selected item isn't fully visible
Diffstat (limited to 'program/js')
-rw-r--r--program/js/treelist.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/program/js/treelist.js b/program/js/treelist.js
index d6d50e4f7..fec2d7f21 100644
--- a/program/js/treelist.js
+++ b/program/js/treelist.js
@@ -442,8 +442,12 @@ function rcube_treelist_widget(node, p)
*/
function scroll_to_node(li)
{
- var scroller = container.parent();
- scroller.scrollTop(li.offset().top - scroller.offset().top + scroller.scrollTop());
+ var scroller = container.parent(),
+ current_offset = scroller.scrollTop(),
+ rel_offset = li.offset().top - scroller.offset().top;
+
+ if (rel_offset < 0 || rel_offset + li.height() > scroller.height())
+ scroller.scrollTop(rel_offset + current_offset);
}
///// drag & drop support