-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript2.js
More file actions
83 lines (57 loc) · 2.07 KB
/
script2.js
File metadata and controls
83 lines (57 loc) · 2.07 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
77
78
79
80
81
82
(function () {
const link = document.querySelectorAll('nav > .nav-button');
const cursor = document.querySelector('.cursor');
const animateit = function (e) {
const span = this.querySelector('span');
const { offsetX: x, offsetY: y } = e,
{ offsetWidth: width, offsetHeight: height } = this,
move = 25,
xMove = x / width * (move * 2) - move,
yMove = y / height * (move * 2) - move;
span.style.transform = `translate(${xMove}px, ${yMove}px)`;
if (e.type === 'mouseleave') span.style.transform = '';
};
const editCursor = e => {
const { clientX: x, clientY: y } = e;
cursor.style.left = x + 'px';
cursor.style.top = y + 'px';
};
link.forEach(b => b.addEventListener('mousemove', animateit));
link.forEach(b => b.addEventListener('mouseleave', animateit));
window.addEventListener('mousemove', editCursor);
})();
const daysEl = document.getElementById("days");
const hoursEl = document.getElementById("hours");
const minsEl = document.getElementById("mins");
const secondsEl = document.getElementById("seconds");
const hackDay = "17 dec 2022";
function countdown() {
const newYearsDate = new Date(hackDay);
const currentDate = new Date();
const totalSeconds = (newYearsDate - currentDate) / 1000;
const days = Math.floor(totalSeconds / 3600 / 24);
const hours = Math.floor(totalSeconds / 3600) % 24;
const mins = Math.floor(totalSeconds / 60) % 60;
const seconds = Math.floor(totalSeconds) % 60;
daysEl.innerHTML = 0;
hoursEl.innerHTML = 0;
minsEl.innerHTML = 0;
secondsEl.innerHTML = 0;
}
function formatTime(time) {
return time < 10 ? `0${time}` : time;
}
// initial call
countdown();
setInterval(countdown, 1000);
var navLinks = document.getElementById("nav-links");
var imgMain = document.getElementById("img15");
let width = screen.width;
function showmenu(){
navLinks.style.display = "block";
}
function hidemenu(){
if ( width < 764 ){
navLinks.style.display = "none";
}
}