-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
127 lines (82 loc) · 2.78 KB
/
script.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
const baseBody = $('.baseBody');
const eyes = $('.eyesPick');
const brows = $('.browPick')
const lips = $('.lipPick')
const hair = $('.hairPick');
const tops = $('.topPick');
const minCol = $('.minCol');
const modal = $('.modal');
const randomize = $('.fa-dice');
const coWheel = $('.colorwheel');
$(".skinBlob").click(function() {
// Get the "alt" attribute of the clicked image
const skinPick = $(this).attr("alt");
// Log the alt text to the console
console.log(`Selected Skin Tone: ${skinPick}`);
baseBody.attr("src", `/images/skin colors/skin_${skinPick}.png`);
});
$(".eyeCh").click(function() {
const eyePick = $(this).attr("alt");
eyes.attr("src", `/images/eyes/eye_${eyePick}.png`);
minCol.click(function() {
const minAlt = $(this).attr("alt");
eyes.attr("src", `/images/eyes/eye_${eyePick}_${minAlt}.png`);
});
});
$(".browCh").click(function() {
const browPick = $(this).attr("alt");
brows.attr("src", `/images/eyes/brows/brow_${browPick}.png`);
});
$(".lipCh").click(function() {
const lipPick = $(this).attr("alt");
lips.attr("src", `/images/lips/lip${lipPick}.png`);
});
$(".hairCh").click(function() {
const hairPick = $(this).attr("alt");
hair.attr("src", `/images/hair/hair_${hairPick}.png`);
});
$(".topCh").click(function() {
const topPick = $(this).attr("alt");
tops.attr("src", `/images/tops/top_${topPick}.png`);
});
randomize.click(function() {
const browsImages = [
'/images/eyes/brows/browcon/browcon_01.png',
'/images/eyes/brows/browcon/browcon_02.png',
'/images/eyes/brows/browcon/browcon_03.png',
'/images/eyes/brows/browcon/browcon_04.png',
'/images/eyes/brows/browcon/browcon_05.png'
];
brows.src = browsImages[getRandomInt(0, browsImages.length - 1)];
});
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
/* MODAL FUNCTIONALITY */
coWheel.click(function() {
modalOpen();
});
// coWheel.click(function() {
// const colAlt = $(this).attr("alt");
// switch(colAlt){
// case 'eye':
// modalOpen();
// minCol.click(function() {
// const minAlt = $(this).attr("alt");
// console.log(minAlt);
// eyes.attr('src', `/images/eyes/eye_01_${minAlt}.png`);
// });
// break;
// }
// });
// function getColor() {
// minCol.click(function() {
// const minAlt = $(this).attr("alt");
// });
// }
function modalOpen() {
$('.modal').toggleClass('modal-show');
}
$('.fa-circle-xmark').click(function() {
modalOpen();
});