Skip to content
This repository was archived by the owner on Feb 3, 2024. It is now read-only.

Commit 42987f7

Browse files
committed
docs: use classList.replace
1 parent 1dd6fbe commit 42987f7

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

packages/docs/index.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,14 @@ window.addEventListener(
124124
() => {
125125
if (window.scrollY > 200) {
126126
if (!showingFloatingButton) {
127-
floatingButtonEl.classList.remove('opacity-0')
128-
floatingButtonEl.classList.add('opacity-100')
129-
topBarEl.classList.remove('pointer-events-none')
130-
topBarEl.classList.add('pointer-events-auto')
127+
floatingButtonEl.classList.replace('opacity-0', 'opacity-100')
128+
topBarEl.classList.replace('pointer-events-none', 'pointer-events-auto')
131129
showingFloatingButton = true
132130
}
133131
} else {
134132
if (showingFloatingButton) {
135-
floatingButtonEl.classList.add('opacity-0')
136-
floatingButtonEl.classList.remove('opacity-100')
137-
topBarEl.classList.add('pointer-events-none')
138-
topBarEl.classList.remove('pointer-events-auto')
133+
floatingButtonEl.classList.replace('opacity-100', 'opacity-0')
134+
topBarEl.classList.replace('pointer-events-auto', 'pointer-events-none')
139135
showingFloatingButton = false
140136
}
141137
}

0 commit comments

Comments
 (0)