-
Notifications
You must be signed in to change notification settings - Fork 0
/
reviews.js
31 lines (29 loc) · 1.06 KB
/
reviews.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
const authors = document.querySelectorAll('#reviews .authors h1');
const comments = document.querySelectorAll('#reviews .comments .comment p');
let counter = 0;
interval = setInterval(() => {
if(counter%2===0){
authors.forEach(author => {
author.classList.remove('move-to-zero');
author.classList.add('move-to-minus-one-hundred');
});
comments.forEach(comments => {
comments.classList.remove('move-to-zero');
comments.classList.add('move-to-minus-one-hundred');
});
comments[0].style.opacity = '0';
comments[1].style.opacity = '1';
} else{
authors.forEach(author => {
author.classList.add('move-to-zero');
author.classList.remove('move-to-minus-one-hundred');
});
comments.forEach(comment => {
comment.classList.add('move-to-zero');
comment.classList.remove('move-to-minus-one-hundred');
});
comments[0].style.opacity = '1';
comments[1].style.opacity = '0';
}
counter++;
}, 3000);