-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomprasjavascript.js
More file actions
69 lines (45 loc) · 939 Bytes
/
comprasjavascript.js
File metadata and controls
69 lines (45 loc) · 939 Bytes
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
const panels=document.querySelectorAll('.panel');
// console.log(panels);
function expandingcards()
{
let i;
for(i=0;i<panels.length;i++)
{
panels[i].addEventListener('click',removeclass);
panels[i].addEventListener('click',addclass.bind(this,i));
}
}
function addclass(i)
{
panels[i].classList.add('active');
}
function removeclass()
{
for(i=0;i<panels.length;i++)
{
panels[i].classList.remove('active');
}
}
expandingcards();
var ProdImg = document.getElementByClassName("ProdImg");
var smallimg = document.getElementByClassName("small-img");
smallimg[0].onclick = function()
{
ProdImg.src=smallimg[0].src;
}
smallimg[1].onclick = function()
{
ProdImg.src=smallimg[1].src;
}
smallimg[2].onclick = function()
{
ProdImg.src=smallimg[2].src;
}
smallimg[3].onclick = function()
{
ProdImg.src=smallimg[3].src;
}
smallimg[4].onclick = function()
{
ProdImg.src=smallimg[3].src;
}