-
Notifications
You must be signed in to change notification settings - Fork 0
/
index2.js
66 lines (56 loc) · 2.23 KB
/
index2.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const box = document.querySelectorAll('.box');
const search = document.querySelector('.search');
const comedybtn = document.querySelector('.comedybtn');
const romanticbtn = document.querySelector('.romanticbtn');
const Actionbtn = document.querySelector('.Actionbtn');
const ratingbtn = document.querySelector('.ratingbtn');
const removebtn = document.querySelector('.removebtn');
search.addEventListener('keyup', function (event) {
const word = event.target.value.toLowerCase();
box.forEach(item => {
item.querySelector('h2').textContent.toLowerCase().includes(word) ||
item.querySelector('.genre').textContent.toLowerCase().includes(word)?
(item.style.display = 'block') : (item.style.display = 'none');
})
})
comedybtn.addEventListener('click', ()=> {
box.forEach(item => {
item.querySelector('.genre').textContent.includes('комедия')?
(item.style.display = 'block') : (item.style.display = 'none');
})
})
romanticbtn.addEventListener('click', ()=> {
box.forEach(item => {
item.querySelector('.genre').textContent.includes('мелодрама')?
(item.style.display = 'block') : (item.style.display = 'none');
})
})
Actionbtn.addEventListener('click', ()=> {
box.forEach(item =>{
item.querySelector('.genre').textContent.includes('боевик')?
(item.style.display = 'block') : (item.style.display = 'none');
})
})
ratingbtn.addEventListener('click', () => {
box.forEach (item => {
item.querySelector('.number').textContent.startsWith('7') ||
item.querySelector('.number').textContent.startsWith('8') ||
item.querySelector('.number').textContent.startsWith('9')?
(item.style.display = 'block') : (item.style.display = 'none');
})
})
removebtn.addEventListener ('click', ()=> {
box.forEach(item => {
item.style.display = 'block';
})
})
gsap.timeline()
.to('h1',{
text: 'Кинотека',
duration:2
})
gsap.from('.comedybtn', {width:0, opacity:0, duration:1})
gsap.from('.romanticbtn', {width:0, opacity:0, duration:1})
gsap.from('.Actionbtn', {width:0, opacity:0, duration:1})
gsap.from('.ratingbtn', {width:0, opacity:0, duration:1})
gsap.from('.removebtn', {width:0, opacity:0, duration:1})