fix NaN and Infinity displayed in short page

This commit is contained in:
Miranquil 2021-01-22 23:59:16 +08:00
parent 10b2a0675b
commit bc128e1a8d
No known key found for this signature in database
GPG Key ID: F7AD72C904129DCB
1 changed files with 2 additions and 0 deletions

View File

@ -36,6 +36,8 @@ KEEP.initUtils = () => {
const percent_dom = this.back2TopButton_dom.querySelector('.percent'); const percent_dom = this.back2TopButton_dom.querySelector('.percent');
if (percent === '0') { if (percent === '0') {
this.back2TopButton_dom.style.display = 'none'; this.back2TopButton_dom.style.display = 'none';
} if (percent !== percent || !isFinite(percent)) {
this.back2TopButton_dom.style.display = 'none';
} else { } else {
this.back2TopButton_dom.style.display = 'flex'; this.back2TopButton_dom.style.display = 'flex';
percent_dom.innerHTML = percent; percent_dom.innerHTML = percent;