mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-29 07:58:31 +02:00
@@ -63,3 +63,4 @@ body {
|
|||||||
@import 'partials/breadcrumbs';
|
@import 'partials/breadcrumbs';
|
||||||
@import 'partials/footer';
|
@import 'partials/footer';
|
||||||
@import 'partials/not-found';
|
@import 'partials/not-found';
|
||||||
|
@import 'partials/go-to-top-button';
|
||||||
|
|||||||
@@ -97,6 +97,10 @@
|
|||||||
display: block;
|
display: block;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-bottom: $spacer * 0.5;
|
margin-bottom: $spacer * 0.5;
|
||||||
|
// hide native details marker
|
||||||
|
&::-webkit-details-marker {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
.go-to-top-button {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
right: 20px;
|
||||||
|
color: $neutral-30;
|
||||||
|
background: $neutral-94;
|
||||||
|
z-index: 10;
|
||||||
|
transition: background-color 0.3s;
|
||||||
|
|
||||||
|
[data-theme="light"] & {
|
||||||
|
color: $neutral-30;
|
||||||
|
background: $neutral-94;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-theme="dark"] & {
|
||||||
|
color: $neutral-94;
|
||||||
|
background: $neutral-30;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,3 +24,24 @@ export function scrollIntoViewWithOffset(id, offset) {
|
|||||||
export function isNodeList(list) {
|
export function isNodeList(list) {
|
||||||
return Object.prototype.isPrototypeOf.call(NodeList.prototype, list);
|
return Object.prototype.isPrototypeOf.call(NodeList.prototype, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function initGoToTopButton(selector) {
|
||||||
|
const button = document.querySelector(selector || '.go-to-top');
|
||||||
|
|
||||||
|
if (!button) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('scroll', () => {
|
||||||
|
const shouldShow = window.scrollY > window.innerHeight / 3;
|
||||||
|
button.classList.toggle('d-block', shouldShow);
|
||||||
|
button.classList.toggle('d-none', !shouldShow);
|
||||||
|
});
|
||||||
|
|
||||||
|
button.addEventListener('click', () => {
|
||||||
|
window.scrollTo({
|
||||||
|
top: 0,
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import scrollHandler from './scroll-handler';
|
import scrollHandler from './scroll-handler';
|
||||||
import { XXL_BREAKPOINT } from './constants';
|
import { XXL_BREAKPOINT } from './constants';
|
||||||
|
import { initGoToTopButton } from './helpers';
|
||||||
|
|
||||||
// on document ready
|
// on document ready
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
@@ -75,4 +76,5 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
initGoToTopButton('#scrollToTopBtn');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,6 +9,9 @@
|
|||||||
{{ block "main" . }}{{ end }}
|
{{ block "main" . }}{{ end }}
|
||||||
</main>
|
</main>
|
||||||
{{ partial "footer" . }}
|
{{ partial "footer" . }}
|
||||||
|
{{ if or (in (slice "documentation" "benchmarks") .Section) (and (.IsPage) (in (slice "blog" "articles") .Section)) }}
|
||||||
|
{{ partial "go-to-top-button" . }}
|
||||||
|
{{ end }}
|
||||||
</body>
|
</body>
|
||||||
{{ partial "js.html" . }}
|
{{ partial "js.html" . }}
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<button class="d-none button button_outlined go-to-top-button" id="scrollToTopBtn" title="Go to top">Up!</button>
|
||||||
Reference in New Issue
Block a user