Ver código fonte

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

Thibaut 11 anos atrás
pai
commit
2327397876

+ 1 - 1
assets/javascripts/lib/util.coffee

@@ -173,7 +173,7 @@ $.scrollTo = (el, parent, position = 'center', options = {}) ->
 
 
   switch position
   switch position
     when 'top'
     when 'top'
-      parent.scrollTop = top - (options.margin or 20)
+      parent.scrollTop = top - (if options.margin? then options.margin else 20)
     when 'center'
     when 'center'
       parent.scrollTop = top - Math.round(parentHeight / 2 - el.offsetHeight / 2)
       parent.scrollTop = top - Math.round(parentHeight / 2 - el.offsetHeight / 2)
     when 'continuous'
     when 'continuous'

+ 1 - 1
assets/javascripts/views/sidebar/doc_list.coffee

@@ -91,7 +91,7 @@ class app.views.DocList extends app.View
     return
     return
 
 
   scrollTo: (model) ->
   scrollTo: (model) ->
-    $.scrollTo @find("a[href='#{model.fullPath()}']")
+    $.scrollTo @find("a[href='#{model.fullPath()}']"), null, 'top', margin: 0
     return
     return
 
 
   afterRoute: (route, context) =>
   afterRoute: (route, context) =>