Pārlūkot izejas kodu

enhance: search block jumps to the correct position

Tienson Qin 4 gadi atpakaļ
vecāks
revīzija
3681835c9c
2 mainītis faili ar 3 papildinājumiem un 2 dzēšanām
  1. 1 1
      src/main/frontend/handler/route.cljs
  2. 2 1
      src/main/frontend/util.cljc

+ 1 - 1
src/main/frontend/handler/route.cljs

@@ -80,7 +80,7 @@
 (defn jump-to-anchor!
   [anchor-text]
   (when anchor-text
-    (ui-handler/highlight-element! anchor-text)))
+    (js/setTimeout #(ui-handler/highlight-element! anchor-text) 200)))
 
 (defn set-route-match!
   [route]

+ 2 - 1
src/main/frontend/util.cljc

@@ -404,7 +404,8 @@
             (.scroll (app-scroll-container-node)
                      #js {:top (let [top (element-top elem 0)]
                                  (if (< top 256)
-                                   0 top))
+                                   0
+                                   (- top 80)))
                           :behavior "smooth"}))))))
 
 #?(:cljs