Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Interactive Books</title>
<style>
body {
font-family: Arial, sans-serif;
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: 1px solid #ccc;
border-radius: 5px;
margin: 10px;
padding: 20px;
text-align: center;
cursor: pointer;
transition: transform 0.3s ease;
.book:hover {
transform: scale(1.05);
.hidden {
display: none;
.page {
padding: 10px;
margin: 10px;
background-color: #f9f9f9;
border: 1px solid #ddd;
border-radius: 5px;
</style>
</head>
<body>
<div class="book" onclick="showContents('book1')">Book 1</div>
<div class="book" onclick="showContents('book2')">Book 2</div>
<div id="book1" class="hidden">
<h2>Book 1 Contents</h2>
<div class="page">Page 1: Introduction</div>
<div class="page">Page 2: Chapter 1</div>
<div class="page">Page 3: Chapter 2</div>
</div>
<div id="book2" class="hidden">
<h2>Book 2 Contents</h2>
<div class="page">Page 1: Preface</div>
<div class="page">Page 2: Chapter 1</div>
<div class="page">Page 3: Chapter 2</div>
</div>
<script>
function showContents(id) {
var content = [Link](id);
if ([Link]('hidden')) {
[Link]('hidden');
} else {
[Link]('hidden');
</script>
</body>
</html>
Html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Books Library</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
<div class="book" onclick="openBook('book1')">Book 1</div>
<div class="book" onclick="openBook('book2')">Book 2</div>
<div id="bookContent" class="hidden">
<h2 id="bookTitle"></h2>
<div id="bookPages"></div>
<a id="downloadLink" href="#" download>Download</a>
</div>
<script src="[Link]"></script>
</body>
</html>
Css
.hidden {
display: none;
.book {
cursor: pointer;
padding: 10px;
margin: 5px;
background-color: #f0f0f0;
border: 1px solid #ccc;
border-radius: 5px;
#bookContent {
margin-top: 20px;
#bookPages {
margin-top: 10px;
#downloadLink {
display: block;
margin-top: 10px;
}
[Link]
function openBook(bookName) {
var bookTitle = [Link]('bookTitle');
var bookPages = [Link]('bookPages');
var downloadLink = [Link]('downloadLink');
if (bookName === 'book1') {
[Link] = 'Book 1';
[Link] = 'This is the content of Book 1.';
[Link] = '[Link]'; // Provide the path to the PDF file of Book 1
} else if (bookName === 'book2') {
[Link] = 'Book 2';
[Link] = 'This is the content of Book 2.';
[Link] = '[Link]'; // Provide the path to the PDF file of Book 2
var bookContent = [Link]('bookContent');
[Link]('hidden');