-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNeflix.js
30 lines (26 loc) · 1.06 KB
/
Neflix.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
let a = document.getElementsByClassName("box")[5]; // Select the first element with class 'box-1'
a.addEventListener("mouseover", () => {
// Check if the new element already exists
let existingElement = document.querySelector(".newbox");
if (!existingElement) {
// Create a new element only if it doesn't exist
const newele = document.createElement('div');
newele.className = 'newbox';
newele.textContent = 'Under development';
// Append the new element to the container
a.appendChild(newele);
// Give it a moment to be added to the DOM before applying the slide-down effect
setTimeout(() => {
newele.classList.add('show'); // Slide down
}, 10); // A small delay to trigger animation
} else {
// If the element exists, toggle its visibility (slide up or down)
if (existingElement.classList.contains('show')) {
existingElement.classList.remove('show');
existingElement.classList.add('hide');
} else {
existingElement.classList.remove('hide');
existingElement.classList.add('show');
}
}
});