Skip to content

Commit 484ab1b

Browse files
committed
chore: remove jquery from toggleSettingsGroup
1 parent 9d709c7 commit 484ab1b

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

frontend/src/styles/settings.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
.settingsGroup {
5151
display: grid;
5252
gap: 2rem;
53+
overflow: hidden;
5354
&.quickNav {
5455
justify-content: center;
5556
.links {

frontend/src/ts/pages/settings.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import * as CustomBackgroundPicker from "../elements/settings/custom-background-
4343
import * as CustomFontPicker from "../elements/settings/custom-font-picker";
4444
import * as AuthEvent from "../observables/auth-event";
4545
import * as FpsLimitSection from "../elements/settings/fps-limit-section";
46-
import { qsr } from "../utils/dom";
46+
import { qs, qsr } from "../utils/dom";
4747

4848
let settingsInitialized = false;
4949

@@ -759,13 +759,28 @@ function toggleSettingsGroup(groupName: string): void {
759759
//The highlight is repeated/broken when toggling the group
760760
handleHighlightSection(undefined);
761761

762-
const groupEl = $(`.pageSettings .settingsGroup.${groupName}`);
763-
groupEl.stop(true, true).slideToggle(250).toggleClass("slideup");
764-
if (groupEl.hasClass("slideup")) {
762+
const groupEl = qs(`.pageSettings .settingsGroup.${groupName}`);
763+
if (!groupEl?.hasClass("slideup")) {
764+
groupEl?.animate({
765+
height: 0,
766+
duration: 250,
767+
onComplete: () => {
768+
groupEl?.hide();
769+
},
770+
});
771+
groupEl?.addClass("slideup");
765772
$(`.pageSettings .sectionGroupTitle[group=${groupName}]`).addClass(
766773
"rotateIcon",
767774
);
768775
} else {
776+
groupEl?.show();
777+
groupEl?.setStyle({ height: "" });
778+
const height = groupEl.getOffsetHeight();
779+
groupEl?.animate({
780+
height: [0, height],
781+
duration: 250,
782+
});
783+
groupEl?.removeClass("slideup");
769784
$(`.pageSettings .sectionGroupTitle[group=${groupName}]`).removeClass(
770785
"rotateIcon",
771786
);

0 commit comments

Comments
 (0)