From 232739787686467bc07c58225b78eaf2183245eb Mon Sep 17 00:00:00 2001 From: Thibaut Date: Sat, 8 Mar 2014 11:24:41 -0500 Subject: [PATCH] Show selection at the top of the sidebar on reset/reveal --- assets/javascripts/lib/util.coffee | 2 +- assets/javascripts/views/sidebar/doc_list.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/javascripts/lib/util.coffee b/assets/javascripts/lib/util.coffee index 7d5ff6d2..4e6ee8df 100644 --- a/assets/javascripts/lib/util.coffee +++ b/assets/javascripts/lib/util.coffee @@ -173,7 +173,7 @@ $.scrollTo = (el, parent, position = 'center', options = {}) -> switch position when 'top' - parent.scrollTop = top - (options.margin or 20) + parent.scrollTop = top - (if options.margin? then options.margin else 20) when 'center' parent.scrollTop = top - Math.round(parentHeight / 2 - el.offsetHeight / 2) when 'continuous' diff --git a/assets/javascripts/views/sidebar/doc_list.coffee b/assets/javascripts/views/sidebar/doc_list.coffee index af405998..f6db01b9 100644 --- a/assets/javascripts/views/sidebar/doc_list.coffee +++ b/assets/javascripts/views/sidebar/doc_list.coffee @@ -91,7 +91,7 @@ class app.views.DocList extends app.View return scrollTo: (model) -> - $.scrollTo @find("a[href='#{model.fullPath()}']") + $.scrollTo @find("a[href='#{model.fullPath()}']"), null, 'top', margin: 0 return afterRoute: (route, context) =>