Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,5 @@ main .container-main .container-main__content .section-container {
.article-container {
margin: 2.3em 0;
}
}/*# sourceMappingURL=style.css.map */
}/*# sourceMappingURL=style.css.map */

28 changes: 25 additions & 3 deletions css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: "cuprumregular";
src: url("../assets/fonts/cuprum-variablefont_wght-webfont.woff")
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
}
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>STM Constitution</title>
<link rel="stylesheet" href="./css/style.css" />
<<<<<<< HEAD
=======
<script src="js/top.js" async></script>
<link rel="icon" href="./favicons/ms-icon-310x310.png" type="image/x-icon">
>>>>>>> 80efc7e7ca99c0a9a4c752517b80d10f0e566016
</head>
<body >
<opencodelaw spec-url="specs/opencon.yaml"></opencodelaw>
<!-- Include opencon.js -->
<button onclick="topFunction()" id="backToTop" title="Go to top">↑</button>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/4.0.0/js-yaml.min.js"></script>
<script async src="js/opencodelaw.js"></script>
Expand Down
29 changes: 28 additions & 1 deletion js/opencodelaw.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})