瀏覽代碼

Show selection at the top of the sidebar on reset/reveal

Thibaut 11 年之前
父節點
當前提交
2327397876
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      assets/javascripts/lib/util.coffee
  2. 1 1
      assets/javascripts/views/sidebar/doc_list.coffee

+ 1 - 1
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'

+ 1 - 1
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) =>