Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Implements a scroll-to-top element for longer page contexts #97

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ <h1>Name</h1>
</div>

</header>

</code>
</pre>

Expand Down
3 changes: 3 additions & 0 deletions specimen/contexts/archive-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ <h2><a href="#">Open Access in Practice: A Conversation with President Larry Kra

</main>

<!-- Scroll-to-top element -->
<a href="#" class="scroll-to-top" aria-label="Scroll to top"></a>

<footer>
<a class="identity-logo" href="#">Creative Commons</a>

Expand Down
1 change: 1 addition & 0 deletions src/css/vendor/normalize.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
html {
line-height: 1.15; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
scroll-behavior: smooth;
egbadon-victor marked this conversation as resolved.
Show resolved Hide resolved
}

/* Sections
Expand Down
31 changes: 31 additions & 0 deletions src/css/vocabulary.css
Original file line number Diff line number Diff line change
Expand Up @@ -1821,6 +1821,34 @@ body > footer .license svg {

/* program-page context */

/* scroll to top element */

.scroll-to-top{
egbadon-victor marked this conversation as resolved.
Show resolved Hide resolved
position: sticky;
bottom: 20px;
left: 100%;
width: 2.5em;
height: 2.5em;
display: flex;
justify-content: center;
align-items: center;
margin-top: calc(100vh + 200px);
margin-bottom: 10px;

background-color: var(--vocabulary-brand-color-dark-tomato);
egbadon-victor marked this conversation as resolved.
Show resolved Hide resolved
color: var(--vocabulary-brand-color-soft-gold);
border-radius: 50%;
text-decoration: none;
}

.scroll-to-top:hover {
background-color: var(--vocabulary-brand-color-tomato);
}

.scroll-to-top::before{
egbadon-victor marked this conversation as resolved.
Show resolved Hide resolved
content:"↑";
egbadon-victor marked this conversation as resolved.
Show resolved Hide resolved
font-size: 1.2rem;
}

/* responsive contexts */

Expand Down Expand Up @@ -1934,6 +1962,9 @@ body > footer .license svg {
width: 20%;
}

.scroll-to-top{
display: none;
}
}

@media (max-width: 680px) {
Expand Down