Commit 1f01fcdc authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'scroll_below_the_navbar' into 'master'

Scroll below the navbar

Fixes #1866

Show the markdown anchors by scrolling below the fixed top navbar.

See merge request !1390
parents 90e4b400 5140bd88
...@@ -13,3 +13,20 @@ class @ProjectShow ...@@ -13,3 +13,20 @@ class @ProjectShow
$("a[href=" + defaultView + "]").tab "show" $("a[href=" + defaultView + "]").tab "show"
else else
$("a[data-toggle='tab']:first").tab "show" $("a[data-toggle='tab']:first").tab "show"
$(document).ready ->
$(window).load (e) ->
e.preventDefault()
unless location.hash is ""
$("html, body").animate
scrollTop: $(".navbar").offset().top - $(".navbar").height()
, 200
$("a").click (event) ->
link = event.target
isAnchor = link instanceof HTMLAnchorElement
if (location.hash != "" || isAnchor)
$("html,body").animate
scrollTop: $(this).offset().top - $(".navbar").height() - 3
, 200
$(document).ready ->
$(window).load (e) ->
e.preventDefault()
unless location.hash is ""
$("html, body").animate
scrollTop: $(".navbar").offset().top - $(".navbar").height()
, 200
$("a").click (event) ->
link = event.target
isAnchor = link instanceof HTMLAnchorElement
if (location.hash != "" || isAnchor)
$("html,body").animate
scrollTop: $(this).offset().top - $(".navbar").height() - 3
, 200
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment