fix: Only set display none on zap after dissolve

This commit is contained in:
FlorianButz
2026-04-05 20:34:53 +02:00
parent e29ca24c6c
commit 0cf9a5d9a7
2 changed files with 7 additions and 2 deletions

View File

@@ -156,6 +156,8 @@ void main() {
#onComplete = null;
#onComplete = null;
/**
* @param {Document} document Webpage document
*/
@@ -485,6 +487,7 @@ void main() {
* @param {Element} element The element to dissolve
* @param {Function} onComplete Callback for when the animation is complete
*/
dissolve(element, onComplete) {
dissolve(element, onComplete) {
if (!this.#initialized || this.#hasTriggered || !element) {
return;
@@ -493,6 +496,8 @@ void main() {
this.#onComplete = onComplete;
this.#onComplete = onComplete;
const rect = element.getBoundingClientRect();
if (rect.width === 0 || rect.height === 0) {
console.warn("[ZapDissolve]: element has zero size. Skipping dissolve");

View File

@@ -197,10 +197,10 @@ export class ZapOverlay {
this.onZapUpdate();
this.window.requestAnimationFrame(() => {
element.style.visibility = "initial";
element.style.removeProperty("opacity");
});
});
element.style.visibility = "hidden";
element.style.setProperty("opacity", "0", "!important");
});
});
} else {