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

add scroll to top button #5331

Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
4f80e5f
'update: scroll-to-top button setup in registry page'
bintus-ux Oct 4, 2024
b69e316
'little fix'
bintus-ux Oct 4, 2024
9e94417
Merge branch 'main' into opentelemetry-contribution2024-devbranch1
bintus-ux Oct 5, 2024
d954b07
'npm run fix:format fix'
bintus-ux Oct 7, 2024
1c63e6e
Merge branch 'opentelemetry-contribution2024-devbranch1' of https://g…
bintus-ux Oct 7, 2024
6b172dc
'suggested fixes applied'
bintus-ux Oct 7, 2024
0ad8f06
Merge branch 'main' into opentelemetry-contribution2024-devbranch1
bintus-ux Oct 7, 2024
fa1437f
Merge branch 'main' into opentelemetry-contribution2024-devbranch1
bintus-ux Oct 7, 2024
809781c
'fix for file naming and proper syntax review'
bintus-ux Oct 8, 2024
0c7af1e
Merge branch 'opentelemetry-contribution2024-devbranch1' of https://g…
bintus-ux Oct 8, 2024
f721bee
Merge branch 'main' into opentelemetry-contribution2024-devbranch1
bintus-ux Oct 8, 2024
56ffcca
'reverting entry.html file introduced changes'
bintus-ux Oct 8, 2024
64a675d
Merge branch 'opentelemetry-contribution2024-devbranch1' of https://g…
bintus-ux Oct 8, 2024
77bc340
Merge branch 'main' into opentelemetry-contribution2024-devbranch1
bintus-ux Oct 8, 2024
ddb416e
'update: fixes for scrollToTop button'
bintus-ux Oct 9, 2024
abf7189
Merge branch 'opentelemetry-contribution2024-devbranch1' of https://g…
bintus-ux Oct 9, 2024
4be5cce
Merge branch 'main' into opentelemetry-contribution2024-devbranch1
bintus-ux Oct 9, 2024
7abaa9a
'fix'
bintus-ux Oct 9, 2024
b15841d
Merge branch 'opentelemetry-contribution2024-devbranch1' of https://g…
bintus-ux Oct 9, 2024
78146e6
'update: scroll-to-top button setup in registry page'
bintus-ux Oct 4, 2024
3214531
'little fix'
bintus-ux Oct 4, 2024
55422f0
'npm run fix:format fix'
bintus-ux Oct 7, 2024
7965ddf
'suggested fixes applied'
bintus-ux Oct 7, 2024
00244a0
'fix for file naming and proper syntax review'
bintus-ux Oct 8, 2024
2decbe2
'reverting entry.html file introduced changes'
bintus-ux Oct 8, 2024
6ffa8bf
'update: fixes for scrollToTop button'
bintus-ux Oct 9, 2024
9577652
'fix'
bintus-ux Oct 9, 2024
97bd65b
Merge branch 'opentelemetry-contribution2024-devbranch1' of https://g…
bintus-ux Nov 8, 2024
e96665d
'fix for issues pointed out after review'
bintus-ux Nov 8, 2024
55a83b6
Merge branch 'main' into opentelemetry-contribution2024-devbranch1
bintus-ux Nov 8, 2024
7dbfc28
'running format fix'
bintus-ux Nov 8, 2024
d361410
Merge branch 'opentelemetry-contribution2024-devbranch1' of https://g…
bintus-ux Nov 8, 2024
de39020
'implementing scroll-to-top on all pages'
bintus-ux Nov 12, 2024
3a5a396
'fix'
bintus-ux Nov 12, 2024
274b700
Merge branch 'main' into opentelemetry-contribution2024-devbranch1
bintus-ux Nov 12, 2024
a0219f9
Fix submodule reference for themes/docsy
bintus-ux Nov 12, 2024
4959ae5
Merge branch 'opentelemetry-contribution2024-devbranch1' of https://g…
bintus-ux Nov 12, 2024
634895e
'fix'
bintus-ux Nov 12, 2024
50035a7
Revert submodule themes/docsy to original commit
bintus-ux Nov 12, 2024
39c0d50
Updated submodules to latest commits
bintus-ux Nov 12, 2024
d22d89e
'scroll-to-top button for registry page'
bintus-ux Nov 12, 2024
5b8dae9
Merge branch 'main' into opentelemetry-contribution2024-devbranch1
bintus-ux Nov 13, 2024
9510a79
fix submodules
svrnm Nov 13, 2024
c8e93f7
'fix and runing fix:format'
bintus-ux Nov 13, 2024
0274e4e
Merge branch 'main' into opentelemetry-contribution2024-devbranch1
bintus-ux Nov 13, 2024
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
19 changes: 19 additions & 0 deletions assets/js/scroll-to-top.js
svrnm marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Get the button
let scrollToTopBtn = document.getElementById('scrollToTopBtn');

// When the user scrolls down 200px from the top of the document, show the button
window.onscroll = function () {
if (
document.body.scrollTop > 200 ||
document.documentElement.scrollTop > 200
) {
scrollToTopBtn.style.display = 'block';
} else {
scrollToTopBtn.style.display = 'none';
}
};

// Scroll to the top when the button is clicked
scrollToTopBtn.onclick = function () {
window.scrollTo({ top: 0, behavior: 'smooth' });
};
28 changes: 28 additions & 0 deletions assets/scss/_registry.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,31 @@
.registry-entry {
@extend .shadow;
}

// Scroll-to-top button styling
.scroll-to-top-btn {
position: fixed;
bottom: 40px;
right: 40px;
background-color: #007bff;
color: white;
border: none;
padding: 12px;
border-radius: 50%;
cursor: pointer;
display: none; // Initially hidden
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
z-index: 1000;

&:hover {
background-color: #0056b3;
}
}

@media screen and (max-width: 768px) {
.scroll-to-top-btn {
bottom: 20px;
right: 20px;
padding: 10px;
}
}
chalin marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions content/en/ecosystem/registry/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ weight: 20

{{% /blocks/lead %}}

<div style="text-align: center; margin-top: 20px;">
<button id="scrollToTopBtn" class="scroll-to-top-btn">
bintus-ux marked this conversation as resolved.
Show resolved Hide resolved
<i class="fas fa-arrow-up"></i>
</button>
</div>

{{< blocks/section color="white" type="container-lg" >}}

{{< ecosystem/registry/search-form >}}
Expand Down
3 changes: 3 additions & 0 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
{{ partialCached "scripts.html" . }}
</body>
</html>

{{ $js := resources.Get "js/scroll-to-top.js" | minify | fingerprint }}
<script src="{{ $js.Permalink }}"></script>
svrnm marked this conversation as resolved.
Show resolved Hide resolved
Loading