You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And here's our [final code](https://www.codedex.io/@Julien/build/randomizer-generator-final-code).
234
+
235
+
## Bonus Challenges
236
+
237
+
### Avatar Creator
228
238
229
239
You can use the same logic above to create a monster or an avatar. Here's a fun example, using the heads, torsos, and legs of monsters from Monster's Inc, Inside Out, Minions.
This example also shows an alternate way of designing the arrows so the three characters swap heads, torsos, and legs at the same time.
234
244
235
-
## Adding more categories
245
+
### Adding more categories
236
246
237
247
So – what if we have our avatar and want to add another category, like shoes? Here's how we'd do that:
238
248
239
-
### HTML
240
-
241
249
In the HTML, you'll need to add a new section for shoes. This will look similar to how the other sections are structured. You would add the following HTML code:
This creates a new section with an image for shoes and navigation buttons (previous and next). You can place this code in the `<div class="main-container">` along with the other categories.
254
262
255
-
### CSS
256
-
To add styling for the shoes category, follow the same pattern as for other categories! Anywhere that you currently have
263
+
To add CSS styling for the shoes category, follow the same pattern as for other categories! Anywhere that you currently have
257
264
```css
258
265
.addons-image,
259
266
.tops-image,
260
-
.bottoms-image {
267
+
.bottoms-image
261
268
```
262
269
You'll also add `.shoes-image`.
263
-
### JavaScript
270
+
264
271
In JavaScript, you'll need to add a new category to the categories object. Each category includes an array of images, an index to track the current image, references to the HTML elements, and button IDs for navigation. Here's how you'll add the shoes category:
265
272
```
266
273
constcategories= {
267
274
…
268
-
shoes: { // Add new category for shoes
275
+
shoes: {
269
276
images: [
270
277
// Your shoe images go here
271
278
],
@@ -278,18 +285,17 @@ const categories = {
278
285
```
279
286
You'll add a `shoes` key with an array of image URLs, an index to track the current image, an element to target the HTML image element, and button IDs for the next and previous buttons.
280
287
281
-
## Bonus Challenge
288
+
### Mismatch
282
289
283
290
If you've already added a fourth section, try making a feature that toggles a pop-up that says "mismatch!" when the outfit doesn't match. Or, if you're creating a monster, the feature could say the sound the monster would make, depending on the combinations.
0 commit comments