btcpayserver/BTCPayServer/Views/Shared/_NavLayout.cshtml
d11n ce174d507d
Prevent initial scroll to section nav (#3411)
* Prevent initial scroll to section nav

On pages taht contain a section nav (sub navigation) the previous `scrollIntoView` led to an initial scroll position start at the section nav. See the store or server settings for examples.

This fixes it so that the scroll vertical position always starts at 0.

* Mobile: Prevent anchors from disappearing underneath the fixed header

* Add content padding top to scroll padding
2022-02-06 20:39:52 +09:00

33 lines
762 B
Plaintext

@using NBitcoin
@{
Layout = "/Views/Shared/_Layout.cshtml";
ViewBag.ShowMenu = ViewBag.ShowMenu ?? true;
if (!ViewData.ContainsKey("NavPartialName"))
{
ViewData["NavPartialName"] = "_Nav";
}
}
@section PageHeadContent {
@await RenderSectionAsync("PageHeadContent", false)
}
@section PageFootContent {
@await RenderSectionAsync("PageFootContent", false)
}
@if (ViewBag.ShowMenu)
{
<partial name="@ViewData["NavPartialName"].ToString()" />
<script>
(function () {
const activeEl = document.querySelector('#SectionNav .nav .active')
if (activeEl) activeEl.scrollIntoView({ block: 'end', inline: 'center' })
})()
</script>
}
<partial name="_StatusMessage" />
@RenderBody()