Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo-mod-jslibs-dist.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'alpinejs/packages/collapse/dist/module.esm.js')
-rw-r--r--alpinejs/packages/collapse/dist/module.esm.js23
1 files changed, 10 insertions, 13 deletions
diff --git a/alpinejs/packages/collapse/dist/module.esm.js b/alpinejs/packages/collapse/dist/module.esm.js
index c108a61..82fc363 100644
--- a/alpinejs/packages/collapse/dist/module.esm.js
+++ b/alpinejs/packages/collapse/dist/module.esm.js
@@ -6,7 +6,7 @@ function src_default(Alpine) {
if (!el._x_isShown)
el.style.height = `${floor}px`;
if (!el._x_isShown)
- el.style.removeProperty("display");
+ el.hidden = true;
if (!el._x_isShown)
el.style.overflow = "hidden";
let setFunction = (el2, styles) => {
@@ -15,7 +15,6 @@ function src_default(Alpine) {
} : revertFunction;
};
let transitionStyles = {
- overflow: "hidden",
transitionProperty: "height",
transitionDuration: `${duration}s`,
transitionTimingFunction: "cubic-bezier(0.4, 0.0, 0.2, 1)"
@@ -24,14 +23,11 @@ function src_default(Alpine) {
in(before = () => {
}, after = () => {
}) {
+ el.hidden = false;
+ el.style.display = null;
let current = el.getBoundingClientRect().height;
- Alpine.setStyles(el, {
- height: "auto"
- });
+ el.style.height = "auto";
let full = el.getBoundingClientRect().height;
- Alpine.setStyles(el, {
- overflow: null
- });
if (current === full) {
current = floor;
}
@@ -40,6 +36,9 @@ function src_default(Alpine) {
start: {height: current + "px"},
end: {height: full + "px"}
}, () => el._x_isShown = true, () => {
+ if (el.style.height == `${full}px`) {
+ el.style.overflow = null;
+ }
});
},
out(before = () => {
@@ -50,13 +49,11 @@ function src_default(Alpine) {
during: transitionStyles,
start: {height: full + "px"},
end: {height: floor + "px"}
- }, () => {
- }, () => {
+ }, () => el.style.overflow = "hidden", () => {
el._x_isShown = false;
if (el.style.height == `${floor}px`) {
- Alpine.nextTick(() => Alpine.setStyles(el, {
- overflow: "hidden"
- }));
+ el.style.display = "none";
+ el.hidden = true;
}
});
}