-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
53 lines (46 loc) · 1.29 KB
/
main.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
document.addEventListener('DOMContentLoaded', () => {
const rotateText = document.getElementById('rotating-text');
var rotatingTextSection = document.getElementById("rotating-text-section");
const helloArray = [
"Hello",
"Hola",
"Hallo",
"你好",
"Halo",
"Bonjour",
"Ciao",
"こんにちは"
];
const loveArray = [
"My Love",
"Amore Mio",
"Meine Liebe",
"Sayangku",
"Mi Amor",
"愛しい人",
"Mon Amour",
"我的爱人"
];
const images = [
"assets/img/r1.jpg",
"assets/img/r2.jpg",
"assets/img/r3.jpg",
"assets/img/r4.jpg",
"assets/img/r5.jpg",
"assets/img/r6.jpg",
"assets/img/r7.jpg"
]
var i = 0;
setInterval(function() {
rotatingTextSection.style.backgroundImage = "url(" + images[i] + ")";
i = i + 1;
if (i == images.length) {
i = 0;
}
}, 1500);
setInterval(() => {
const randomIndex = Math.floor(Math.random() * helloArray.length);
const randomIndex2 = Math.floor(Math.random() * helloArray.length);
rotateText.textContent = helloArray[randomIndex] + ', ' + loveArray[randomIndex2]+ ' ♥';
}, 2000)
});