Code
Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Interactive Books</title>
<style>
body {
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f4f4f4;
.book {
width: 200px;
height: 300px;
background-color: #fff;
border-radius: 5px;
margin: 10px;
padding: 20px;
text-align: center;
cursor: pointer;
.book:hover {
transform: scale(1.05);
.hidden {
display: none;
.page {
padding: 10px;
margin: 10px;
background-color: #f9f9f9;
border-radius: 5px;
</style>
</head>
<body>
<h2>Book 1 Contents</h2>
</div>
<h2>Book 2 Contents</h2>
</div>
<script>
function showContents(id) {
if (content.classList.contains('hidden')) {
content.classList.remove('hidden');
} else {
content.classList.add('hidden');
</script>
</body>
</html>
Html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Books Library</title>
</head>
<body>
<h2 id="bookTitle"></h2>
<div id="bookPages"></div>
</div>
<script src="script.js"></script>
</body>
</html>
Css
.hidden {
display: none;
.book {
cursor: pointer;
padding: 10px;
margin: 5px;
background-color: #f0f0f0;
border-radius: 5px;
#bookContent {
margin-top: 20px;
#bookPages {
margin-top: 10px;
#downloadLink {
display: block;
margin-top: 10px;
}
Script.js
function openBook(bookName) {
bookContent.classList.remove('hidden');