diff options
author | cmcnulty <cmcnulty@kznf.com> | 2013-10-29 21:32:21 -0500 |
---|---|---|
committer | cmcnulty <cmcnulty@kznf.com> | 2013-10-29 21:32:21 -0500 |
commit | 741f387c149a834397a42612bc31b27962d5caa0 (patch) | |
tree | 642eace666455d70437f7e8ebd01015f5f4de1ec | |
parent | a222f5c045c2a6c14b3c961b83a2d8ee9d3c9331 (diff) |
fix scrolling up
Make sure that the fixed header is never over a message
-rw-r--r-- | program/js/list.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/program/js/list.js b/program/js/list.js index 8ad0a336b..131d44977 100644 --- a/program/js/list.js +++ b/program/js/list.js @@ -1245,7 +1245,8 @@ scrollto: function(id) { var row = this.rows[id].obj; if (row && this.frame) { - var scroll_to = Number(row.offsetTop); + var scroll_to = Number(row.offsetTop), + head_offset = 0; // expand thread if target row is hidden (collapsed) if (!scroll_to && this.rows[id].parent_uid) { @@ -1254,9 +1255,14 @@ scrollto: function(id) scroll_to = Number(row.offsetTop); } - if (scroll_to < Number(this.frame.scrollTop)) - this.frame.scrollTop = scroll_to; - else if (scroll_to + Number(row.offsetHeight) > Number(this.frame.scrollTop) + Number(this.frame.offsetHeight)) + if(this.fixed_header) + head_offset = Number(this.thead.offsetHeight); + + // if row is above the frame (or behind header) + if (scroll_to < Number(this.frame.scrollTop) + head_offset) { + // scroll window so that row isn't behind header + this.frame.scrollTop = scroll_to - head_offset; + } else if (scroll_to + Number(row.offsetHeight) > Number(this.frame.scrollTop) + Number(this.frame.offsetHeight)) this.frame.scrollTop = (scroll_to + Number(row.offsetHeight)) - Number(this.frame.offsetHeight); } }, |