diff --git a/content/.vuepress/theme/Layout.vue b/content/.vuepress/theme/Layout.vue index 38e7428..2f0b8c9 100644 --- a/content/.vuepress/theme/Layout.vue +++ b/content/.vuepress/theme/Layout.vue @@ -324,10 +324,41 @@ localStorage.setItem("hide lbry alert", true); document.querySelector("#alert-beta").style.display = "none"; }; + + document.querySelectorAll("a[href^='#']").forEach(anchor => { + anchor.addEventListener("click", function (e) { + e.preventDefault(); + + const element = this.href.split("#").pop(); + let elementOffset; + + if (document.getElementById(element)) { + elementOffset = document.getElementById(element).offsetTop - 74; + window.scroll({ top: elementOffset, behavior: "smooth" }); + } + }); + }); + + scrollToElementOnLoad(); }, beforeDestroy () { - updateMetaTags(null, this.currentMetaTags) + updateMetaTags(null, this.currentMetaTags); + scrollToElementOnLoad(); + } + } + + function scrollToElementOnLoad() { + if (window.location.href.includes("#")) { + setTimeout(() => { // give page time to breathe + const element = window.location.href.split("#").pop(); + let elementOffset; + + if (document.getElementById(element)) { + elementOffset = document.getElementById(element).offsetTop - 74; + window.scroll({ top: elementOffset, behavior: "smooth" }); + } + }, 150); } } diff --git a/content/contribute/index.md b/content/contribute/index.md index c675668..48347fb 100644 --- a/content/contribute/index.md +++ b/content/contribute/index.md @@ -96,7 +96,7 @@ Opening well-specified issues against release candidates or master builds is ext If you're about to raise an issue because you've found a problem with LBRY, or you'd like to request a new feature, or for any other reason, please read this first. -GitHub is the preferred channel for [bug reports](#report-a-bug) and [feature requests](#feature-requests). +GitHub is the preferred channel for [bug reports](#reporting-a-bug) and [feature requests](#feature-requests). ### Reporting a Bug @@ -104,8 +104,8 @@ A bug is a _demonstrable problem_ that is caused by the code in the repository. Guidelines for bug reports: 1. **Identify the correct repo**. See [ecosystem overview](#ecosystem-overview). While it's okay if you get this wrong, it's a big help to us if you get it right. -2. **Use the GitHub issue search** — check if the issue has already been reported (or fixed). Be sure to include closed tickets in your search. -3. **Follow the instructions** - When you open an issue inside of GitHub, each repo contains a template for how to create a good bug report. Please follow it! +2. **Use the GitHub issue search** — check if the issue has already been reported (or fixed). Be sure to include closed tickets in your search. +3. **Follow the instructions** — When you open an issue inside of GitHub, each repo contains a template for how to create a good bug report. Please follow it! Well-specified bug reports save developers lots of time and are extremely appreciated, typically with an LBRY credit tip.