Skip to content
Open
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
4 changes: 3 additions & 1 deletion src/bundle/Resources/public/js/scripts/admin.back.to.top.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
return backToTopBtn.classList.contains('ibexa-back-to-top__btn--visible');
};
let currentBackToTopAnchorHeight = backToTopAnchor.offsetHeight;
const AT_TOP_THRESHOLD = 4;
const setBackToTopBtnVisibility = (container) => {
const shouldBeVisible = container.scrollTop !== 0;
const shouldBeVisible = container.scrollTop > AT_TOP_THRESHOLD;

if (backToTopBtn.classList.contains('ibexa-back-to-top__btn--visible') && !shouldBeVisible) {
backToTopBtn.classList.remove('ibexa-back-to-top__btn--visible');
ibexa.quickAction.recalculateButtonsLayout();
}

if (!backToTopBtn.classList.contains('ibexa-back-to-top__btn--visible') && shouldBeVisible) {
Expand Down
15 changes: 10 additions & 5 deletions src/bundle/Resources/public/scss/_back-to-top.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
min-width: calculateRem(62px);
border-radius: calculateRem(31px);
padding: calculateRem(15px) calculateRem(18px);
display: flex;
justify-content: center;
align-items: center;
background-color: $ibexa-color-white;
opacity: 0;
visibility: hidden;
transition: opacity $ibexa-admin-transition-duration $ibexa-admin-transition;
box-shadow: $ibexa-edit-header-box-shadow;
display: none;
opacity: 0;
transition:
opacity $ibexa-admin-transition-duration $ibexa-admin-transition,
display $ibexa-admin-transition-duration $ibexa-admin-transition allow-discrete;

&:hover {
.ibexa-back-to-top__title {
Expand All @@ -23,8 +24,12 @@
}

&--visible {
display: flex;
opacity: 1;
visibility: visible;

@starting-style {
opacity: 0;
}
}
}

Expand Down
Loading