-
Notifications
You must be signed in to change notification settings - Fork 51
/
explore.js
24 lines (24 loc) · 1.02 KB
/
explore.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
document.addEventListener('DOMContentLoaded', () => {
fetch('https://raw.githubusercontent.com/Ctoic/Lisbook/refs/heads/main/data/books.json')
.then(response => response.json())
.then(data => {
const bookContainer = document.getElementById('book-container');
data.forEach(book => {
const card = document.createElement('div');
card.className = 'card';
card.innerHTML = `
<div class="card-inner">
<div class="card-front">
<img src="${book.cover}" alt="${book.title}">
<h3>${book.title}</h3>
</div>
<div class="card-back">
<p>${book.description}</p>
</div>
</div>
`;
bookContainer.appendChild(card);
});
})
.catch(error => console.error('Error loading book data:', error));
});