{
id: 1,
genre: 'Rock',
image1: '/images/album-covers/jimihindrix-areyouexperienced.jpg',
image2: '/images/album-covers/thedoors.jpg',
},
{
id: 2,
genre: 'Jazz',
image1: '/images/album-covers/somethinelse.jpg',
image2: '/images/album-covers/MilesDavis-BitchesBrew.jpg',
},
{
id: 3,
genre: 'Hip-Hop',
image1: '/images/album-covers/mfdoom-mmfood.jpg',
image2: '/images/album-covers/nas-illmatic.jpg',
},
{
id: 4,
genre: 'Soul',
image1: '/images/album-covers/aliciakeys-diary.jpeg',
image2: '/images/album-covers/ettajames-tellmama.jpg',
},
{
id: 5,
genre: 'Electronic',
image1: '/images/album-covers/burial-tunes.jpg',
image2: '/images/album-covers/björk-homogenic.jpg',
},
{
id: 6,
genre: 'Classic',
image1: '/images/album-covers/sparks-kimonomyhouse.jpg',
image2: '/images/album-covers/chakakhan-rufus.jpg',
},
{
id: 7,
genre: 'Pop',
image1: '/images/album-covers/beatles-sgtpeppers.jpg',
image2: '/images/album-covers/prince-purplerain.png.webp',
},
];
const genreList = document.getElementById('genre-list');
const handleClick = () => {
albums.forEach((album) => {
const content = `[*]${album.genre}`;
genreList.innerHTML += content;
console.log(genreList);
});
};
document.addEventListener('DOMContentLoaded', () => {
handleClick();
});
< /code>
html < /p>
Подробнее здесь: https://stackoverflow.com/questions/797 ... page-loads
Мобильная версия