Skip to content

Commit 232e930

Browse files
committed
Fix
1 parent 05aaeae commit 232e930

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@
163163
});
164164

165165
function onButterflyClick(event) {
166+
// Prevent default behavior and stop propagation
167+
event.preventDefault();
168+
event.stopPropagation();
169+
166170
// Get the clicked element
167171
const butterfly = event.currentTarget;
168172

@@ -173,6 +177,12 @@
173177
const screenX = window.screenX + rect.left;
174178
const screenY = window.screenY + rect.top;
175179

180+
// Clean up hover-img preview before removing the butterfly
181+
const hoverImg = document.getElementById('hover-img');
182+
if (hoverImg) {
183+
hoverImg.remove();
184+
}
185+
176186
// Remove the butterfly from the DOM
177187
butterfly.remove();
178188

0 commit comments

Comments
 (0)