mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-25 07:48:54 +00:00
⚡ Perf(btn): remove fixed buttons fadeOut animate at mobile mode
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+7
-17
@@ -1031,7 +1031,6 @@ class FixIt {
|
||||
const $mask = document.getElementById('mask');
|
||||
this.newScrollTop = this.util.getScrollTop();
|
||||
const scroll = this.newScrollTop - this.oldScrollTop;
|
||||
const isMobile = this.util.isMobile();
|
||||
this.util.forEach($headers, ($header) => {
|
||||
if (scroll > ACCURACY) {
|
||||
$header.classList.remove('animate__fadeInDown');
|
||||
@@ -1045,23 +1044,14 @@ class FixIt {
|
||||
});
|
||||
// whether to show b2t button
|
||||
if (this.newScrollTop > MINIMUM) {
|
||||
if (isMobile && scroll > ACCURACY) {
|
||||
$fixedButtons.classList.remove('animate__fadeIn');
|
||||
this.util.animateCSS($fixedButtons, ['animate__fadeOut', 'animate__faster'], true, () => {
|
||||
$fixedButtons.classList.contains('animate__fadeOut') && $fixedButtons.classList.add('d-none');
|
||||
});
|
||||
} else if (!isMobile || scroll < -ACCURACY) {
|
||||
$fixedButtons.classList.remove('d-none');
|
||||
$fixedButtons.classList.remove('animate__fadeOut');
|
||||
this.util.animateCSS($fixedButtons, ['animate__fadeIn', 'animate__faster'], true);
|
||||
}
|
||||
$fixedButtons.classList.remove('d-none');
|
||||
$fixedButtons.classList.remove('animate__fadeOut');
|
||||
this.util.animateCSS($fixedButtons, ['animate__fadeIn', 'animate__faster'], true);
|
||||
} else {
|
||||
if (!isMobile) {
|
||||
$fixedButtons.classList.remove('animate__fadeIn');
|
||||
this.util.animateCSS($fixedButtons, ['animate__fadeOut', 'animate__faster'], true, () => {
|
||||
$fixedButtons.classList.contains('animate__fadeOut') && $fixedButtons.classList.add('d-none');
|
||||
});
|
||||
}
|
||||
$fixedButtons.classList.remove('animate__fadeIn');
|
||||
this.util.animateCSS($fixedButtons, ['animate__fadeOut', 'animate__faster'], true, () => {
|
||||
$fixedButtons.classList.contains('animate__fadeOut') && $fixedButtons.classList.add('d-none');
|
||||
});
|
||||
}
|
||||
for (let event of this.scrollEventSet) {
|
||||
event();
|
||||
|
||||
Reference in New Issue
Block a user