Skip to content

Commit 700dc7a

Browse files
committed
2 parents 7b2111e + e0e0550 commit 700dc7a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

projects/build-a-randomizer-generator-with-html-css-js/build-a-randomizer-generator-with-html-css-js.mdx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: Build a Randomizer Generator with HTML/CSS/JS
33
author: Julien Kris
4-
uid:
5-
datePublished:
4+
uid: Jps14SaCwqgdbbnYvoMpvMKv92P2
5+
datePublished: 2025-05-09
66
description:
77
header: https://raw.githubusercontent.com/codedex-io/projects/main/projects/build-a-randomizer-generator-with-html-css-js/header.gif
88
published: false
@@ -11,7 +11,6 @@ tags:
1111
- css
1212
- javascript
1313
- intermediate
14-
1514
---
1615

1716
<BannerImage
@@ -61,7 +60,7 @@ Let's take a look at some [starter code](https://www.codedex.io/@Julien/build/ra
6160

6261
If you've taken the HTML, CSS, and JavaScript courses, our web stack for this project will look familiar. We have an HTML file that links to an external CSS stylesheet and an external JavaScript file, all contained within the same folder.
6362

64-
```terminal
63+
```
6564
CluelessGenerator/
6665
├── index.html
6766
├── style.css
@@ -210,7 +209,7 @@ The arrow buttons (`prevBtn` and `nextBtn`) allow the user to navigate through t
210209
211210
When the Next button is clicked, the index for the category increases by 1, and the `updateImage()` function is called to update the displayed image.
212211
213-
```javascript
212+
```
214213
document.getElementById(category.nextBtn).addEventListener("click", () => {
215214
category.index = (category.index + 1) % category.images.length; // Loop back to the first image
216215
updateImage(cat);
@@ -219,7 +218,7 @@ document.getElementById(category.nextBtn).addEventListener("click", () => {
219218
220219
When the Prev button is clicked, the index decreases by 1, and again, the `updateImage()` function is called. It loops back to the last image if you go backward from the first one.
221220
222-
```javascript
221+
```
223222
document.getElementById(category.prevBtn).addEventListener("click", () => {
224223
category.index = (category.index - 1 + category.images.length) % category.images.length; // Loop to last image
225224
updateImage(cat);
@@ -266,7 +265,7 @@ To add styling for the shoes category, follow the same pattern as for other cate
266265
You'll also add `.shoes-image`.
267266
### JavaScript
268267
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:
269-
```javascript
268+
```
270269
const categories = {
271270
272271
shoes: { // Add new category for shoes

0 commit comments

Comments
 (0)