Skip to content

Commit

Permalink
Don't auto scroll when already scrolled ahead
Browse files Browse the repository at this point in the history
Fixes #294
  • Loading branch information
srid committed Jul 20, 2020
1 parent 7de3350 commit 8ef3cb5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion neuron/src/lib/Neuron/Web/Widget/AutoScroll.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ marker elemId offsetPx = do
script :: DomBuilder t m => Text -> m ()
script markerId = do
let s =
"document.getElementById(\"" <> markerId <> "\").scrollIntoView({behavior: \"smooth\", block: \"start\"});"
"if (window.scrollY == 0) { document.getElementById(\"" <> markerId <> "\").scrollIntoView({behavior: \"smooth\", block: \"start\"}); }"
el "script" $ text s

0 comments on commit 8ef3cb5

Please sign in to comment.