-
Notifications
You must be signed in to change notification settings - Fork 18
Medp HW#3 #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Medp HW#3 #12
Conversation
| const photosPerLoad = 6; | ||
|
|
||
| console.log('hello'); | ||
| function renderPhotos(filterType = 'all', limit = true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the use of default values for the parameters!
| document.getElementById('all').addEventListener('click', () => { | ||
| currentIndex = 0; | ||
| renderPhotos('all'); | ||
| }); | ||
|
|
||
| document.getElementById('nature').addEventListener('click', () => { | ||
| currentIndex = 0; | ||
| renderPhotos('nature'); | ||
| }); | ||
|
|
||
| document.getElementById('city').addEventListener('click', () => { | ||
| currentIndex = 0; | ||
| renderPhotos('city'); | ||
| }); | ||
|
|
||
| document.getElementById('animals').addEventListener('click', () => { | ||
| currentIndex = 0; | ||
| renderPhotos('animals'); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clean up your code, a suggestion would be to select all the buttons in one array, and then use a for loop to create a generic click event function for them all.
No description provided.