-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
76 lines (66 loc) · 2.85 KB
/
script.js
File metadata and controls
76 lines (66 loc) · 2.85 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
document.addEventListener('DOMContentLoaded', function() {
const loginForm = document.getElementById('loginForm');
const cubesContainer = document.getElementById('cubesContainer');
// Create multiple floating cubes
function createCubes() {
const cubeCount = window.innerWidth < 768 ? 15 : 30;
for (let i = 0; i < cubeCount; i++) {
const cube = document.createElement('div');
cube.className = 'cube';
cube.style.left = `${Math.random() * 100}vw`;
cube.style.top = `${Math.random() * 100}vh`;
cube.style.animationDuration = `${15 + Math.random() * 15}s`;
cube.style.animationDelay = `${Math.random() * 5}s`;
// Create cube faces
const faces = ['front', 'back', 'right', 'left', 'top', 'bottom'];
faces.forEach(face => {
const faceElement = document.createElement('div');
faceElement.className = `face ${face}`;
cube.appendChild(faceElement);
});
cubesContainer.appendChild(cube);
}
}
// Form submission handler
loginForm.addEventListener('submit', function(e) {
e.preventDefault();
const username = document.getElementById('username').value.trim();
const password = document.getElementById('password').value.trim();
if (username && password) {
// Add animation before redirect
document.querySelector('.login-container').style.animation = 'fadeIn 0.5s ease reverse forwards';
setTimeout(() => {
window.open('https://www.instagram.com/devcubetech/', '_blank');
}, 500);
} else {
// Shake animation for empty fields
const inputs = document.querySelectorAll('.input-box input');
inputs.forEach(input => {
if (!input.value.trim()) {
input.style.animation = 'shake 0.5s';
setTimeout(() => {
input.style.animation = '';
}, 500);
}
});
alert('Please fill in both fields before proceeding.');
}
});
// Add shake animation to CSS dynamically
const style = document.createElement('style');
style.textContent = `
@keyframes shake {
0%, 100% { transform: translateX(0); }
20%, 60% { transform: translateX(-5px); }
40%, 80% { transform: translateX(5px); }
}
`;
document.head.appendChild(style);
// Handle window resize
window.addEventListener('resize', function() {
cubesContainer.innerHTML = '';
createCubes();
});
// Initialize cubes
createCubes();
});