diff --git a/css/style.css b/css/style.css index 4f33f7b..30553f4 100644 --- a/css/style.css +++ b/css/style.css @@ -296,4 +296,5 @@ main .container-main .container-main__content .section-container { .article-container { margin: 2.3em 0; } -}/*# sourceMappingURL=style.css.map */ \ No newline at end of file +}/*# sourceMappingURL=style.css.map */ + diff --git a/css/style.scss b/css/style.scss index 6750ea1..e84a050 100644 --- a/css/style.scss +++ b/css/style.scss @@ -5,6 +5,7 @@ font-weight: normal; font-style: normal; } + @font-face { font-family: "cuprumregular"; src: url("../assets/fonts/cuprum-variablefont_wght-webfont.woff") @@ -24,9 +25,9 @@ $box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.18); padding: 0; transition: all .6s; } - - - +html{ + scroll-behavior: smooth; +} body { background-color: $background-color_light; font-family: $primary-font; @@ -308,3 +309,24 @@ main { margin: 2.3em 0; } } + + +#backToTop { + display: none; + position: fixed; + bottom: 20px; + right: 30px; + z-index: 1000; + border: none; + outline: none; + background-color: #c07534; + color: white; + cursor: pointer; + padding: 15px; + border-radius: 10px; + font-size: 18px; + + &:hover { + background-color: #555; + } +} \ No newline at end of file diff --git a/index.html b/index.html index b66126f..a5e164c 100644 --- a/index.html +++ b/index.html @@ -5,11 +5,16 @@ STM Constitution +<<<<<<< HEAD +======= + +>>>>>>> 80efc7e7ca99c0a9a4c752517b80d10f0e566016 + diff --git a/js/opencodelaw.js b/js/opencodelaw.js index 1919e3a..fa14a0a 100644 --- a/js/opencodelaw.js +++ b/js/opencodelaw.js @@ -378,5 +378,32 @@ function toggleSubMenu(event) { }) .catch((error) => { + console.error("Error loading YAML data:", error); + }); + window.addEventListener("scroll", scrollFunction); + + function scrollFunction() { + const topButton = document.getElementById("backToTop"); + + if ( + document.body.scrollTop > 20 || + document.documentElement.scrollTop > 20 + ) { + topButton.style.display = "block"; + console.log("Block"); + } else { + topButton.style.display = "none"; + console.log("None"); + } + } + + // When the button is clicked, scroll to the top of the document + function topFunction() { + document.body.scrollIntoView({ behavior: "smooth", block: "start" }); + } + + // Add this event listener to handle button click + const topButton = document.getElementById("backToTop"); + topButton.addEventListener("click", topFunction); console.error('Error loading YAML data:', error) - }) + }) \ No newline at end of file